You need to read THE PERSIAN PUZZLE. Mossedegh was a loony, and while popularly elected, he drifted into loonyness and started coddling the Soviets. The Russians controlling the Persian Gulf was unthinkable.
Mossadegh even entertained people in his underwear according to the book. (Ex-Pat Iranians widely love the book)
=========================================================
The only pertinent words in your first sentence are "popularly elected"...the rest is excuse for trashing international law.
Of course iranian ex-pats love the book...it tells their side.