You're leaving out a lot of detail. Yes, Mossadegh stopped counting votes, claiming the election was corrupted by foreign influence, which it to some extent was. Less than half the members of the majlis that had thus been elected belonged to his own party, so that wasn't exactly a power grab for himself.
In the events that followed his popularity rose and he tried to gather a government but was blocked by the shah, which made him even more popular, to the extent that the armed forces backed off from containing the demonstrations. It's against this background he sent a bill to the majlis that would give him six months of emergency powers to push through with his political program and the nationalisation, which was approved.
After those six months he asked for another twelve months and got it, but his base had started to wither away and allies switched sides because the reforms didn't have enough effect fast enough in the international climate they were in. I.e. trade boycott and foreign influence operations and so on, which of course hurt his constituents. Some of his allies were also afraid that he might turn against them, hence they turned on him.
Churchill convinced Eisenhower that Mossadegh were going to deport the shah, and then they launched the coup.
I have no issue with the details, and appreciate the nuance here. I just object to people who frame the situation as "there is no dispute the US and UK overthrew a democratically elected Iranian government"