On the eve of President Hassan Rouhani and foreign minister Mohammad Javad Zarif's departure this week for the annual UN General Assembly meeting in New York, Ayatollah Ali Khamenei appeared to embrace the prospect of a rapprochement with Iran's western adversaries. Speaking at a gathering of members of the Islamic Revolutionary Guard Corps, the Islamic republic's supreme leader declared, "We are not against proper and rational diplomatic moves, be it in the diplomatic sphere, or the sphere of domestic politics." He added, employing a phrase that was widely discussed in the Iranian media and social networks, "Your servant believes in what was coined years ago: 'heroic flexibility.' Flexibility is necessary on certain occasions. It is very beneficial."

This is hardly the first time that Khamenei has introduced a coded phrase into a major pronouncement, and as usual the principlist media outlets raced to interpret it. In this case, the apparent winner was Mohammad Reza Asadzadeh, a writer for Khabar Online, who noted that in 1969, a 30-year-old Khamenei translated into Farsi an Arabic text, Hassan's Peace, in which author Razi el-Yassin discusses the armistice agreed to by Hassan ibn Ali, the second Shia Imam. Asadzadeh pointed out that the young cleric had given the work a new (rather bluntly didactic) subtitle: "History's Most Glorious Exercise of Flexibility."

The eldest son of Ali, the first Shia Imam, Hassan claimed the right to the caliphate after his father's assassination in 661 and declared war against the then caliph, Muawiyah. Realising that he would not be able to defeat the caliph militarily, he accepted a peace accord. Subsequently, according to Shia narratives, Hassan's younger brother, Hossein, backed only by a small group of fighters engaged Muawiyah's son in a battle in which he and his entire family were decimated.

"See, in this regime, anytime they want to talk of standing in the face of tyranny, they point to Imam Hossein, and whenever they are seeking moderation and consensus, they recall Imam Hassan. Two distinctly different models," said a religious scholar who follows Iranian politics.

"The pronouncement by Agha ["sir," a common epithet for the supreme leader] suggest that until further notice, we are henceforth following the Hassan model. That is: Hello diplomacy, so long martyrdom."

A senior political journalist observed that Khamenei had also used the phrase 17 years ago, during President Akbar Hashemi Rafsanjani's second term, in a meeting with foreign ministry officials. The supreme leader was quoted as saying, "Iran's political envoys to the world must be sharper than a sword, softer than gossamer, and tougher than stone and annealed steel. Foreign political affairs is an arena for heroic flexibility, but a flexibility which is cutting to the enemy." He delivered the speech during a period when relations between the Islamic republic and the EU had been strained to the breaking point by a string of state-sponsored assassinations of Iranian opposition figures around Europe, including the killing of former prime minister Shapour Bakhtiar in 1991 and the infamous Mykonos affair the following year.

A Green Movement activist who served time in prison after the 2009 protests remarked on an adjoining passage in this week's speech in which the ayatollah said, "The diplomatic sphere is a realm of smiles. They smile, and also negotiate." Smiling himself, the activist commented, "Seven months ago, his eminence was a revolutionary. Suddenly he has turned diplomat."

He was recalling a previous speech the supreme leader had made to a gathering of Revolutionary Guards in which he had separated himself from those advocating negotiation with the United States. "I am not a man of diplomacy," Khamenei stated then. "I am a revolutionary and that is why I speak brazenly, honestly, and decisively."

The activist continued, "It is of greatest importance that he gave his speech [this week] at a gathering of military leaders. They had seen themselves as the masters of Iran's nuclear programme and had readied themselves to pay any price for its advancement. But now Mr. Khamenei has unexpectedly rediscovered his diplomatic soul.

"I am not saying that they would be furious at Khamenei's action – their relationship is of a mentor and disciples. But ... certainly they must be demoralised a great deal."

The ayatollah's recent statements have put Iran's most vociferously right-wing media outlets in something of a bind. The Kayhan daily, as always, has dedicated its front page to the supreme leader's declarations, while carefully avoiding any reference to "heroic flexibility." One representative headline this week read, "Global Changes Can't Be Excuses for Deviating from Revolution's Principles."

Kayhan's arch-conservative editor in chief, Hossein Shariatmadari, long regarded as one of Khamenei's closest confidants in the media, has recently turned over editorial-writing responsibilities to an associate, Mohammad Imani. The tension between endorsing the supreme leader's apparent repositioning while maintaining a hardline on negotiations with the west is evident in Imani's writing: "As the much emulated sage of the revolution has explicated, while the path to diplomacy, negotiation, ingenuity, and tactical flexibility is not blocked, it is important to appreciate the key point that diplomacy is fundamentally an approach and a tool, and what gives it endurance is the strength of its inherent structure. In other words, one can't expect diplomacy to be the bearer of the responsibility for struggle, resistance, domestic innovations, and the realisation of internal potentials, or god forbid, to approach the enemy from a demoted stance."

At the conservative Resalat daily, meanwhile, political editor Salleh Eskandari chose to define the criteria for "heroic flexibility" as the condemnation of atrocities by "American and Zionist occupiers." He also warned Rouhani's newly appointed negotiating team not to follow the path taken a decade ago by the administration of the reformist Mohammad Khatami: "No flexibility is heroic without pursuit of justice and confrontation of abuse, and no level of tolerance will achieve any goals as we travelled that road during the reformist period and didn't meet with any results."

Mashregh News, the hardliners' hardline website, took aim at several reformist dailies for their choice of headlines regarding the supreme leader's speech – Bahar, Aftab, and Shargh each ran the headline "We Trust in Heroic Flexibility in Diplomacy," while Etemaad went with "Tactical Application of Heroic Flexibility."

According to a Mashregh editorial, such characterisations of Khamenei's statement are "wrong and inappropriate. Of course the peace accord by Imam Hassan, all God's blessings be upon him, was and remains a justified and acceptable event; it was a responsibility which the irreproachable Imam had to fulfill and not a speck of fault sticks to it. Whereas the point is that our nation's issue today is not the same issue as Imam Hassan's armistice. ... It is not possible to accept the erroneous takes by some political factions and imagine that Muslim Iran has fallen weak and feeble, that it has been stricken by doubts about its future, or it is prepared to back away from its goals."

A political affairs journalist at one of the leading reformist dailies, who requested anonymity both for himself and his paper, said, "It is quite obvious that the right-wing media is in shock. It is true that Mr. Khamenei says lots of contradictory things lots of times, but his speech ... was very transparent: just hours prior to the departure of Rouhani and Zarif for New York he suddenly says, 'Exercise flexibility.'

"Of course, the right-wingers are really shameless. They still can't accept the reality that Khamenei respects Rouhani's policies and has trust in him. They continue to try to portray that Agha didn't mean that but rather this. That's to be expected.

According to the journalist, Iran's right-wing media have long "used any sort of excuse to support any wrangling with the west. It wasn't important to them that people were being sacrificed under the [weight] of the sanctions. For eight years they wrote in that manner. Now it is tough for them to face the new circumstances. As they say, [quitting a habit] 'cold turkey makes you sick.'"

A self-described socialist opposition activist argued that it is not certain that Khamenei has firmly decided to seek a quick reconciliation. "One again I've been reminded what a grand leader [Ayatollah Ruhollah] Khomeini was," he said.

Referring to the decision by the Islamic republic's first supreme leader to accept a UN-backed ceasefire after eight years of war with Iraq, the activist said of Khomeini, "When he was convinced that continuing the 'battle, battle till victory' policy was to the regime's and the people's detriment, he emptied the hemlock chalice in one gulp without trepidation or vacillation. These days, they are taking small sips from that chalice. They reflect and dither, but they keep on drinking."

Tehran Bureau's Nuclear Watch series monitors the way the Iranian media reports the country's nuclear programme