Savvy Iranian voters, many of them young, female, middle-class, and from ethnic and religious minorities, helped prevent another Mahmoud Ahmadinejad from rising.

Majid Saeedi / Getty Images

ISTANBUL — Mohammad Javad Haghshenas had been all but banished from public life. Once a ranking official in the Ministry of Culture under the liberal presidency of Mohammad Khatami, he was hounded out of government by conservative hardliners and then, when he began editing a reformist newspaper, dragged for years through Iran’s revolutionary courts on charges like “acting against the system.” But because of a controversial and much-criticized decision by Iranians last year to take part in the parliamentary elections, the 56-year-old Haghshenas was cleared to run this year in Tehran’s municipal elections. Last week, Iranian voters handed total control of Tehran’s 21-member city council to reformists while placing moderates and independents in charge of local councils that oversee at least 18 of the country’s 20 largest cities, according to preliminary results published by Iranian media. In the rural, impoverished, and mostly minority-Sunni southeastern province of Sistan and Baluchistan, the official IRNA state news agency reported that 415 women were elected to various city and village councils. And a woman received the highest number of votes on the municipal council overseeing Bandar Abbas, a Persian Gulf port city of 500,000.

FARS Mohammad Javad Haghshenas

“This election drew more voters than any other election in the last 40 years,” Haghshenas told BuzzFeed News in a phone interview from Tehran. “This election was a phenomenon. People in Iran and particularly in Tehran said a big no to hardliners. Iranians showed that they are looking for peace and dialogue.” Iran’s opaque political system combines elements of a theocratic dictatorship with features of a democratic republic. Voters regularly elect a president and members of parliament, but a Guardian Council of clerics and jurists vet all national candidates, and a top-ranking cleric, Supreme Leader Ali Khamenei, exercises final say on all crucial matters of state. The convoluted structure has set up a sort of long-term chess game. A politically savvy, mostly youthful and middle-class population yearning to open the country to the world and loosen social and political restrictions tries to outmaneuver Iran’s aging conservative clerical and military leaders. The endgame: winning control of the levers of power to shape the country. The sweeping victories by Iran’s moderates in the May 19 elections show how seasoned Iranian voters, many of them young, female, middle-class, and from ethnic and religious minorities, managed to game the political system to get the relatively palatable Hassan Rouhani back into office. As president, Rouhani will have a key role in deciding the next supreme leader if the 77-year-old Khamenei dies during his four-year term. The local council wins may also prevent another populist hardliner, like former president Mahmoud Ahmadinejad or the current mayor of Tehran Mohammad-Baqer Qalibaf, from gaining a national platform — and set up a new arena of political and cultural confrontation between hardliners and reformists. The machinations began last year, when the Guardian Council barred most reformists from running for parliamentary elections and the powerful council that will choose Khamenei’s replacement. After the names of approved candidates emerged, exiled Iranians called for a boycott while some Washington pundits criticized the vote as phony.

Tima Agency / Reuters Supporters of Rouhani celebrate his victory in Tehran.

But egged on by Khatami and other moderates, Iranians voted in droves anyway. They sometimes held their noses and cast ballots for figures implicated in human rights abuses, just to keep worse candidates out of office. As a result Rouhani’s allies expanded their control of the parliament. Among lawmakers’ duties in parliament is forming committees to vet candidates for municipal and local council elections. Those committees managed to approve larger numbers of reformists and moderates, setting the stage for Friday’s victory of reformists like Haghshenas. “This is a result of people’s participation in parliamentary elections and the reformists and moderates' success last year,” said Mohammad Ali Kadivar, an Iran specialist at Brown University's Watson Institute. “What you see is a reward for voting in parliament elections.” Local councils don’t have a lot of power in Iran, where authority is highly centralized. But among their duties is choosing and overseeing mayors. The mayorship of Tehran, a city with as many as 12 million inhabitants, is a high-profile job, with as many resources as any ministry. Ahmadinejad used his role as Tehran’s mayor as a springboard to the presidency. Qalibaf, the current mayor, tried but failed to use the same formula against Rouhani. Now the top candidate for the job is said to be Mohammed Hashemi, the brother of the late Ayatollah Ali Akbar Rafsanjani and former manager of the Tehran metro system. He is regarded as a relative moderate.

Anadolu Agency / Getty Images Mohammad Hashemi could become the next mayor of Tehran.