Iran's agreement last year to join international negotiations over its disputed nuclear program stirred a new debate about the country's enigmatic supreme leader, Ayatollah Ali Khamenei.
Was the cleric an implacable revolutionary, as he claimed, who would never yield to the West? Or did he have a less visible pragmatic side that could allow compromise over his country's controversial nuclear program?
This month's international negotiations in Vienna over that program have filled in more details about the elusive leader. And in the view of some Western officials and private experts, the emerging portrait is not encouraging for those who hope for a landmark nuclear deal that would restrict Iran to nonmilitary nuclear activities and resolve a top world security issue.
The talks, which were extended for four months after failing to reach a deal by a July 20 deadline, suggested that Khamenei may be willing to compromise on some important issues. But on the contentious core question – Iran's uranium enrichment capacity – Khamenei signaled he won't yield to the demands of six world powers for a scaled-back program, but rather insists on having a bigger effort, sooner, than the world powers will accept.
This month's round seemed to resolve another much-discussed issue: whether Khamenei would stand back and give a free hand to a negotiating team led by relative moderates. Since Khamenei surprised Western officials -- and his negotiators -- on July 7 by laying down, in surprising technical detail, a set of negotiating "red lines," it has been clear that he guides the Iranian moves.
"The leader of the revolution, Ayatollah Khamenei, leads the negotiations," Iranian President Hassan Rouhani tweeted on Sunday.
Since the Obama administration and Iran began secret talks last year that opened the way for negotiations, a bargain has been implied. The six world powers -- the United States, Britain, China, France, Germany and Russia -- would lift tough sanctions on Iran's economy in exchange for a rollback of its uranium enrichment infrastructure.
But it appears Khamenei wants to take home a victory on both issues: elimination of the sanctions and preservation of almost all of the nuclear program.
"He doesn't seem ready to make the fundamental compromise," said Suzanne Maloney, an Iran specialist at Brookings Institution.
Robert Einhorn, who was a member of President Obama's inner circle of Iran advisors until last year, wrote last weekend that Iran has been quietly moving the goal posts on enrichment.
For years it focused on a demand that the West accept its right to a domestic enrichment program. But since the administration accepted that idea, Iran has increased its demands: Now it says it's entitled to an industrial-scale enrichment program, unlimited research and development, and a seven-year "sunset clause" on the deal, after which it will have the same leeway as other countries.
Einhorn calls the quiet expansion of these demands "rights creep."
Khamenei is essentially saying that he wants to be able to live up to all his promises to Iranians on how the nuclear program, a matter of national pride, can never get smaller, but will only expand.
His view is that world powers' demands for less hardware, more intrusive inspections and suspension rather than elimination of sanctions are just more Western bullying that he won't accept.
"If a deal is going to have his imprimatur, it has to preserve his dignity and respect the founding principles of the Islamic revolution," said Ali Vaez, an Iran specialist in Istanbul for the International Crisis Group.
U.S. officials have been saying that the negotiations aren't between two equal parties. Iran is a repeat violator of international rules and has to acknowledge that and change its behavior, they say.
But Khamenei "doesn't see this as a negotiation of equal parties, either – he expects the other side to give in," said a Western diplomat, who requested anonymity citing the sensitivity of the issue.
Khamenei's tough positions this month suggest he's ready to walk away from a deal, if necessary, even though that would mean more economic hardship for Iran's battered middle class and potentially more social unrest.
Iran has shown flexibility on some important points, the six world powers say. For example, it has been discussing design changes to its Arak heavy-water reactor to reduce its production of plutonium, which could be used to make weapons.
But compromises on such issues won't be enough to bring home an agreement. Congress, which will probably have the power to kill a deal once it is signed, is more focused on enrichment capacity than any other issue.
Is it possible that Khamenei's demands are only posturing and he might yield at the last minute?
So far, said Maloney of Brookings Institution, "there's really no evidence to suggest that's the case."