You win some, you lose some. A week after Lebanon’s elections were won by the moderate, pro-western forces, Iran has gone the other way: conservative president Mahmoud Ahmadinejad was re-elected with 62.6% of the vote, against 33.8% for his reformist challenger, former prime minister Mir Hossein Mousavi.

Make no mistake, this is a major setback for Barack Obama’s diplomatic plans and the prospects for peace in the Middle East. Ahmadinejad’s paranoia will only have been increased by the support Mousavi received from educated, middle class Iranians, including many within the governing elite: he will be less likely than ever to listen to demands to discontinue the country’s nuclear program or to moderate his anti-Israeli rhetoric.

In his confrontational stance he has a willing partner in Israel’s Benjamin Netanyahu, who yesterday was finally prevailed upon to utter the words “Palestinian state” — something that he will only support, however, if it lacks all the usual attributes of statehood, such as control of its own borders.

It’s tempting to conclude that Netanyahu and Ahmadinejad deserve each other. Certainly they feed off each other’s intransigence, and each would find his task much harder if the other did not provide a ready-made bogeyman.

For these purposes it makes little difference whether Ahmadinejad’s victory was in fact fair or not. Unless actual fraud can be proved, or something happens to make him lose the support of supreme leader Ali Khamenei, he looks to be securely in power for another four years.

It’s natural to respond to unpleasant events by exoticising them, by pretending that somewhere like Iran is unfamiliar territory with unknowable rules of its own. In reality, however, a democratic win for Ahmadinejad would be neither particularly surprising nor lacking in familiar precedents.

An obvious recent case is the 2005 and 2007 elections in Thailand, both won by right-wing populist Thaksin Shinawatra (the second in his absence, after he had been overthrown and exiled by the military).

Looking just at the manifestations of public opinion in Bangkok that would seem inexplicable; urban middle-class voters supported his opponents, and they — like Mousavi’s supporters in Iran — were the ones who showed up on the evening news.

But Thaksin had huge reserves of support among the rural poor, which came good for him at election time.

The same dynamic was at work in Europe for most of the nineteenth century. Liberal and revolutionary forces enjoyed strong support is cities like Paris and Vienna, but they could not carry the countryside with them. Kings and emperors were repeatedly able to rely on the conservative peasantry to help them suppress demands for reform.

Tehran is Bangkok is Paris: although Iran, now rapidly urbanising, is no longer a peasant society, the poor are still eager consumers of Ahmadinejad’s brand of populism. The educated urban elites are much more visible to western observers, but they do not amount to a majority at the ballot box.

That clash of views could make the president’s second term a very difficult time.