When Mahmud Ahmadinejad was elected to a second term as president in 2009 as a result of what is widely regarded as vote-rigging, Iran's younger generation played a leading role in the massive street protests that ensued and gave birth to the opposition Green Movement.

Iran's rulers were shaken. For the first time since the days of the shah, Iranians screamed "death to the dictator!" from Tehran's rooftops. Iran's youth were energized -- and angry.

It was Iran's younger generation (60 percent of the country's population is under the age of 30) that was at the heart of the Green Movement, and it was that generation's political spirit that the government sought to crush. The heavy-handed clampdown -- forever seared into memory by the shooting death of 26-year-old philosophy student and protester Neda Agha Soltan -- eventually muted the mass street demonstrations, jailed the moderate opposition's most ardent supporters and leaders, and allowed the establishment to continue on almost as before.

For Iran's young, however, it was a different story. Bereft of morale or leadership, they became increasingly apolitical under the second term of the virulently anti-Western Ahmadinejad and watched -- almost helplessly -- as their country became more isolated and more mistrusted and more extreme.

It was a source of depression for many Iranians, but an interesting thing happened: as young people became increasingly disenfranchised from politics, they poured their energies into other areas. Recent years have witnessed an explosion of creativity in art, music and, above all, theater.

As Ahmadinejad railed against the West, Iranian youth sculpted and painted and wrote. As he refused to negotiate over Iran's nuclear program, they directed plays and made underground documentaries. They created an oasis of culture in a political desert.

But in its short life the country's 1905-11 Constitutional Revolution provided a lasting foundation for a parliament and other hallmarks of democracy that could not be abandoned decades later by the founders of the Islamic republic.

Preeminent among the lasting democratic ideas was the holding of elections -- prime-ministerial (and later presidential) polls every four years, and parliamentary every two years. Iran's revolutionaries preserved this tradition as they recalibrated the state and rewrote the constitution to suit their new, Islamic, republic.

The new model features the election of presidents -- whose power pales in comparison to that of the supreme leader but who have significant influence on domestic and foreign policy and serve as the face of the nation abroad -- but this doesn't mean that they emerge from a democratic exercise.

The system is imperfect. The Guardians Council, a 12-member body that includes six jurists directly appointed by the supreme leader, strikes out the overwhelming majority of potential candidates (mainly for being too reformist-minded). This year, of the more than 1,600 who threw their hat into the ring, only six were approved as candidates for the May 19 election. Among those who didn't make the cut was Ahmadinejad, and the field narrowed further when two of the six dropped out of the race.

Great Role To Play

Enter -- or rather, reenter -- Iran's youth on the political scene. While their political impulse had appeared to die with the demise of the Green Movement, it turns out it merely went into hibernation.

While the disappointment of 2009 pushed some of Iran's youth to drop politics altogether, the arrival of a more moderate voice in the 2013 election served to revive their interest in politics.

Hassan Rohani won the 2013 presidency on a platform of resolving Iran's nuclear crisis and improving its relations with the outside world -- policies that chime perfectly with the under-30 demographic. Now, the incumbent is running for reelection and the view from Tehran is cautiously positive.

Rohani owed his win in 2013 partly due to the mobilization of young people, and they stand to play a great role in this election as well.

Things on the ground in Tehran are changing almost hourly. The emergence of Ebrahim Raisi, the ultraconservative candidate and confidante of Supreme Leader Ayatollah Ali Khamenei who along with Rohani is seen as a front-runner, has put a scare into people.

If Raisi wins, Iran could see a return to the adversarial stance of the Ahmadinejad days. A dangerous deterioration of relations with Washington -- perhaps increasing the risk of military conflict -- becomes a very real possibility.

The view from Tehran is clear. "A few hours before the election, people have [been] woken up ... especially by the fear of Ebrahim Raisi and a return to the past," says an observer in Tehran who has covered the country over the course of more than a decade and interviewed youth inside Iran at length. Rohani's open discussion of freedoms and women's rights, too, has provided a spark. "It affects the undecideds," says the observer, who spoke to RFE/RL on condition of anonymity. "Young activists have also been mobilized. Many have moved to Tehran or other cities to get people out to vote."

The West has talked about regime change in Iran since almost the very beginnings of the Islamic republic in 1979. The truth is that, like the Roman Empire, the system will almost certainly crumble from within. The young, frustrated by the lack of economic prospects and attempts to cut them off from the West, are too numerous to be ignored.

Economic mismanagement over the course of decades has left the government unable to find many of them jobs in government like it once did -- and that is dangerous for the ruling elite.

While the youth still have a political pulse, it is weak -- at least for the moment. But the ballot box remains one of the few ways for the younger generation to voice its displeasure with the state of affairs in Iran. The situation is not ideal -- their preferred candidate, Rohani, is a pragmatist, not a reformer. He will not give Iran's Western-facing young all the freedoms they want.

But he is the best chance they have at seeing the more open Iran they desperately want. And if he wins tomorrow it will be because Iran's youth is, once again, beginning to roar.

David Patrikarakos is the author of Nuclear Iran: The Birth Of An Atomic State. He is a contributing editor at The Daily Beast and his work has appeared in The New York Times, The Wall Street Journal, the Financial Times, The Guardian, Politico, Foreign Policy, The Spectator, The New Republic, The New Statesman, and many others.