Just as the Middle East appeared to be heading for conflict, following the Syrian deadlock and the nuclear standoff between Iran and the US, suddenly there is a chink of light.

An apparent reformist pledged to improving relations with the West, Hassan Rouhani, has been elected as President of Iran. A multi-linguist who has a law doctorate from Glasgow Caledonian University, Rouhani has been critical of Ahmedinijad's confrontational rhetoric against America.

But this was not a democratic election in any sense that we would understand it. Iran is a Muslim theocracy, and the candidates, Rouhani included, were chosen by the Guardian Council, which is dominated by clerics appointed by the Supreme religious leader, Ayatollah Ali Khamenei.

Leaders of the failed, democratic Green Revolution of 2009 were barred from standing, and even the former Iranian president, Hashemi Rafsanjani, was black-balled.

All candidates have a history of anti-democratic practices, including Rouhani, who in 1999 called for the death penalty for student demonstrators.

However, his election perhaps indicates the Ayatollahs have realised their anti-western policies are leading the country to ruin.

The country is grappling with desperate economic problems caused largely by economic sanctions by America and the European Union.

Hopefully, Rouhani will reopen negotiations with President Obama over Iran's nuclear programme, in exchange for sanctions being lifted. Rouhani may also curb Iranian support for the Syrian dictator, Bashar al-Assad, which has damaged Iran's standing in the Middle East – but the entire region remains a powder-keg.