The apparent restraint of Iranian President Hassan Rouhani's speech before the United Nations General Assembly on Tuesday afternoon seems to have disappointed many Western observers. They charge Rouhani with failing to show much of the "heroic flexibility" that Iran's Supreme Leader, Ayatollah Ali Khamenei, recently claimed would characterize Iran's new diplomatic strategy toward the West. In truth, the West should not be so surprised. Iran's diplomatic offensive of recent weeks is, in fact, a significant shift -- just not in the way most Westerners have seemed to think.

"Heroic flexibility” has never been what most foreign commentators believe it is. It is neither a rhetorical feint to buy time for Iran’s nuclear program, nor is it a signal that Khamenei is desperate to strike a deal with the United States after years of punishing sanctions. Both interpretations have it wrong, and for the same reason -- they fail to interpret Iran’s diplomatic offensive in the context of Khamenei’s grand strategy, which has been consistent from the time he assumed power. Khamenei does not want Iran to be at open conflict with the West, nor does he want it to be a supplicant to the United States. He is signaling that rapprochement is possible, but not at the price of abandoning Iran's resistance to Western hegemony.

Khamenei has spoken of heroic flexibility several times since becoming Iran’s leader over twenty years ago, and in each instance he has emphasized that friendly dialogue is not the same thing as friendship. In a speech on August 7, 1996, before an audience of interior ministry officials and Iranian diplomats, he said, “the sphere of international politics is a field of heroic flexibility, which is sharp faced with the enemy. Therefore, our diplomats must be firm in their principal positions and take as their model His Holiness Imam Khomeini’s steadfastness and manliness.” In a speech delivered to members of the Guardian Council on September 5, 2013, he declared, “When a wrestler is wrestling with an opponent and in places shows flexibility for technical reasons, let him not forget who his opponent is.” Even enemies smile at each other while negotiating, he told Revolutionary Guards commanders on September 17.

Khamenei does not believe that the relationship between Washington and Tehran needs to be overtly hostile, in other words, but he does seem to think that Iran and the West are bound to remain ideological adversaries. Indeed, Khamenei has always contrasted “the Islamic-Iranian model of progress” with what he labels the West’s “tyrannical” model of development. The fundamental goal of the Islamic Republic, he says, has always been to “create a new Islamic civilization.” Khamenei has long envisioned an Iran that is independent, powerful, and technologically advanced, and which has a strong Islamic-Iranian identity.

He also believes that the West is inherently hostile to that vision. That explains, in part, why the nuclear negotiations between Iran and the West have been so contentious. Khamenei genuinely suspects that the United States and its allies want to hinder Iran’s independent scientific development. There are some things that Khamenei thinks an “Islamic civilization” simply cannot compromise on, including the pursuit of independent technological progress, the division of gender roles in social life, and a commitment to public piety as a means of national solidarity.

But within those parameters, pragmatic compromise is always a possibility. Indeed, Khamenei believes that adjusting to new circumstances is an obligation for Islamic civilization if it hopes to survive. One can see that in Khamenei’s approach to women’s rights in the context of Iran’s Islamic identity. He has long argued that it is the duty of all Muslim women to pursue economic and educational advancement -- while keeping their commitment to Islamic identity. In a speech delivered on January 4, 2012, he said, "Women are half of society and it is very good that if we are able, we should use this half of society in [professional, economic, and political life.]." But he made sure to add, "We are in complete agreement with such employment and participation insofar as it does not harm the family institution, which comes first, since it is irreplaceable."

Khamenei is now applying the same sort of conditional pragmatism to international politics. He thinks that Iran must continue to resist Western hegemony, and must maintain a commitment to its Islamic political system; but within those terms, he thinks that Iran and the United States should be able to achieve a mutually beneficial relationship.

In principle, this framework should be familiar to the United States. Khamenei is attempting to follow the road taken by independent nationalist leaders such as Julius Nyerere in Tanzania, Léopold Sédar Senghor in Senegal, Gamal Abdel Nasser in Egypt, and Luiz Inácio Lula da Silva in Brazil. That said, Khamenei believes that the most promising precedent for rapprochement between Tehran and Washington is the relationship between China and the United States, in which the countries treat each other as equals and, for the most part, avoid interfering in each other’s domestic affairs. Khamenei wants to continue to be able to promote Islamic democracy as an alternative to liberal democracy -- much as communist China’s ideological system has been tolerated by the United States.

The question now is whether Khamenei’s concept of heroic flexibility will be sufficient to the task of reducing hostility with the United States. There is some reason to think that it will be. Judging from the events of recent days, including the Iranian government’s release of a group of political prisoners and its hints of domestic liberalization, Khamenei is willing to make some compromises to achieve diplomatic progress. It remains to be seen, of course, how much flexibility he is willing to show when it comes to discussing the details of Iran’s nuclear program.

But the United States should certainly be prepared to consider compromises of its own, including curtailing the sanctions that even the Iranian opposition considers an aggressive affront to national sovereignty and pride. The United States may also have to belatedly recognize the legitimacy of the Islamic Republic, and cease its attempts to manufacture regime change.

But that does not mean that the United States should compromise the pillars of its own identity as a Western democracy. Khamenei himself professes that he wants Iran to be a religious democracy. The United States should hold Iran to that standard, by reminding Khamenei that it is in the interest of Iran and its people to continue to take steps to protect human rights and to liberalize its political system. Only such liberalization, after all, can provide for the stability of the government; and the United States should not be ashamed that such liberalization also happens to be consistent with American ideals.

Nevertheless, the establishment of amicable relations between Iran and the Untied States need not wait until they share the same values. The United States, after all, manages to maintain good relations with Saudi Arabia, Qatar, Bahrain, and the United Arab Emirates, countries that are even farther from democratic ideals than the Islamic Republic. Of course, the United States is free to hold its political and moral values to be above those of the Islamic Republic. But the only way to produce a productive relationship with Khamenei may be to accept that he will continue to act as if Iran’s Islamic model of development is superior to that of liberal democracy.