(CNN) -- Iranian Supreme Leader Ayatollah Ali Khamenei was once a student revolutionary himself, perhaps not much different from the thousands of protesters who this week have taken to the streets in Iran.
Ayatollah Ali Khamenei became a political activist while a religious scholar studying under Ayatollah Ruhollah Khomeini
Khamenei became a political activist while a religious scholar studying under Ayatollah Ruhollah Khomeini, among others, according to his biography on his official Web site.
He was part of a circle of clerics who opposed the rule of the shah of Iran, Mohammed Reza Pahlavi, and was jailed by the shah's secret police, the Savak, at least six times in the 1960s and 1970s. He says he was tortured in prison before being exiled in 1976, three years before the revolution that deposed the shah.
Khomeini was in exile in Paris, France, when the shah fled Iran in 1979. He appointed Khamenei to represent him on an Islamic Revolutionary Council, alongside other key figures such as Ayatollah Ali Akbar Hashemi Rafsanjani.
The appointment may have been a career-making moment for Khamenei, who was a fairly low-level scholar at the time, said Iran analyst Shireen Hunter, a visiting scholar at Georgetown University in Washington. Learn more about Iran's recent history
"He is not qualified to be an ayatollah," or top-ranking Islamic scholar, she said, saying he had picked up the title by dint of succeeding Khomeini as supreme leader, "like an honorary doctorate."
Khamenei, now 70, was briefly minister of defense and head of Iran's Revolutionary Guards in the early 1980s before becoming president, a post he held from 1982 to 1990.
In power, he clashed ideologically with Rafsanjani, favoring a more left-wing politics than Rafsanjani, who came from a more bourgeois background than the poor Khamenei.
He also locked horns with the man who was prime minister when he was president -- Mir Hossein Moussavi, now the most prominent opposition leader.
The two had similar anti-American, left-wing politics but struggled over power in what Hunter called "the two-headed monster" that was then the Iranian political structure.
"There were turf battles between the president and the prime minister," she said.
Khomeini died in 1989, and Khamenei was appointed the next supreme leader. The post of prime minister was abolished.
Rafsanjani seems to have been a "kingmaker" in the elevation of Khamenei to the top job, Hunter said, perhaps thinking he would be the power behind the throne.
But with time, Khamenei has become his own man, she said. Rafsanjani was president in the 1990s, but lost a comeback attempt in 2005 -- defeated by current President Mahmoud Ahmadinejad.
As supreme leader, Khamenei is the ultimate arbiter of policy in Iran.
He appoints the Guardian Council, the country's election authority. He also appoints key posts in the intelligence services and the armed forces, including the powerful Revolutionary Guard. Additionally, he confirms the president's election.
In theory, the supreme leader is appointed by a body of clerics whom voters elect. But in practice, this body -- the Assembly of Experts -- has answered to the supreme leader.
Khamenei's authority has been challenged at times. Nearly half the members of Iran's parliament criticized him openly in 2004 for ordering general elections to go ahead despite a widespread belief that they would not be free or fair.
The elections took place as scheduled.
Khamenei supports the country's controversial nuclear program, and when President Obama reached out directly to the people of Iran with a video message, it was Khamenei who responded.
Khamenei said in March he saw no change in U.S. policy toward Iran despite Obama's promise of a "new beginning."
He said a change in rhetoric was not enough, and Washington must practice what it preaches, according to the English-language Press TV channel in Iran.
He hailed the disputed Iranian presidential election as "a miracle" for the record turnout, but that very public enthusiasm for the election may signal a shift that Khamenei failed to anticipate.
"He has now very much become his own man, but the country has changed," Hunter said.
"Look at the women's situation. They make a big deal out of saying how many women they have educated. That is true, but then you cannot expect them to keep doing things the same way."