Finally, Iranians got the chance to party in the streets. The solid election victory on Friday of the least hard-line candidate — moderate cleric and former nuclear negotiator Hassan Rowhani — touched off spontaneous celebrations in the major squares and avenues of Tehran that authorities did not try to stop.

Women whipped off head scarves and drivers honked their horns in an emotional release after a largely bottled-up election campaign in which carefully vetted candidates had been forbidden from holding big outdoor rallies. Supreme Leader Ayatollah Ali Khamenei, despite his stated desire for a large turnout, had not wanted people to get too excited for fear of a reprise of the mass demonstrations that followed the last presidential elections in 2009. Now, those repressed four years ago have gotten some of their own back.

In far more democratic neighboring Turkey, meanwhile, riot police on Saturday again blasted protestors in Istanbul’s central Taksim Square and a small park nearby with water cannons and tear gas trying to definitively end two weeks of demonstrations that have convulsed the country. Turkish Prime Minister Recep Tayyip Erdogan claimed to have reached an agreement with the protestors to reconsider plans to build a replica Ottoman barracks in Gezi park and wanted the area emptied so he could stage a more congenial rally of his own on Sunday, one led by conservative Muslim supporters.

What unites these incidents in Istanbul and Tehran is not just the fact that it’s early summer and that, as the old song goes, the time is right for dancing in the streets.

From the earliest days of recorded history to today’s Twitterverse, people have come together in central places to express their views and gain strength and comfort from the presence of like-minded others. Every culture has had its agora, forum, maydan, square or park — a place where people can literally vote with their feet. The leaders of both Turkey and Iran sought to choke off this fundamental form of expression — and both have paid a price.

After skillfully pushing a narrative of Turkey as a modern meld of Islam and democracy, Erdogan and his AKP officials have been doing damage control this week. Besir Atalay, a deputy prime minister who happened to be in Washington for a conference, met with D.C. Turkey hands and U.S. officials to convey the message that Turkish democracy is still alive and well.

Although sparked by a small environmental rally, the Taksim demonstrations reflect pent-up anger by Turks upset by creeping Islamization, a neo-Ottoman foreign policy that inserts Turkey into conflicts in Syria and politics elsewhere in the region, and the prime minister’s growing arrogance and micro-managing.

“This is the first time we have seen massive grassroots protests in Turkey,” said Soner Cagaptay, director of the Turkish research program at the Washington Institute for Near East Policy. He predicted more such demonstrations by Turkey’s middle class — a rapidly growing population which, Cagaptay said, is demanding “respect for the right of assembly and association,” freedom of the press, and a focus on the environment. Perhaps as damaging as the images of tear gas and water cannons turned on peaceful protestors in Taksim was Erdogan’s initial dismissal of protestors as hooligans and agents of foreign powers instead of citizens with a right to express their views. Just yesterday, he blamed Jews.

Erdogan’s language is reminiscent of that used by Iranian officials to denigrate the Green Movement back in 2009. Determined to prevent the protests that four years ago filled Tehran’s iconic Azadi Square with millions of people chanting “Where is my vote?” the Iranian government took a number of steps this year to preempt mass public expressions of political sentiment. First, the Guardian Council, the body that vets all candidates for elected office, weeded out more than 600 candidates for office — including the most prominent representatives of views that are not solidly behind Supreme Leader Ayatollah Ali Khamenei: candidates such as former president Akhbar Hashemi Rafsanjani and Esfandiar Rahim Mashaei, the close aide to outgoing president Mahmoud Ahmadinejad.

Then, authorities prohibited the one-on-one televised debates that in 2009 produced dramatic clashes between Ahmadinejad and his chief rival, Mir Hossein Mousavi. This sparring had increased public interest in the election and may have contributed to the high turnout of more than 80 percent. Finally, for the three weeks of the officil campaign, the government blanketed the streets with police and plainclothes security to prevent the sort of rallies that turned major squares and Tehran’s central Vali-Asr avenue into night-long parties in the run-up to the 2009 vote. This was a particularly hard blow to Iranian young people, who have few other opportunities to have a good time in public.(In my experience, young folks only get to come out en masse when Iran celebrates an international soccer victory or during Ashura, a Shiite religious festival that is supposed to be solemn but has turned into an opportunity to mix with members of the opposite sex in public.)

Given these restrictions, flashes of spontaneity this year were limited. But support slowly gathered behind Rowhani after Rafsanjani and former president Mohammad Khatami endorsed him and the lone real reformist in the race dropped out. On the final day of the campaign, Rowhani addressed enthusiastic crowds inside stadiums. There were also reports of least one pro-Rowhani gathering in Tehran’s central Vanak Square on Wednesday and larger rallies in the eastern city of Mashhad. While Iranian officials sought to discourage these demonstrations, they implored people to vote.

In a revealing comment that was also posted on his Twitter account and reflects recognition of his government’s unpopularity, Supreme Leader Khamenei admonished even an Iranian “who may not want to support the Islamic system, but he wants to support his country” to go to the polls. A large turnout — or as Khamenei called it in the days leading up to the vote, “a political epic” — would be a blow to Iran’s foreign enemies that are trying to crush the country with sanctions, the leader said.

In the end, more than 70 percent of Iran’s 50 million eligible voters did turn out on Friday. But the message they sent was not the one of “resistance” their leader had sought. They picked a man who said he would try to ease Iran’s isolation and relieve the heavy atmosphere that has turned Iran into such a repressive society.

Back in Istanbul, however, bulldozers were demolishing tents in Gezi park. And Erdogan, who wants to run for president in 2014, is no longer assured a victory from an increasingly energized electorate. That’s democracy at work.

Barbara Slavin is a senior fellow at the Atlantic Council and Washington correspondent for Al-Monitor. She tweets @BarbaraSlavin1. This piece was originally published on Foreign Policy.

Related Experts: Barbara Slavin