Iran's publicity-loving and populist president has yet again demonstrated his knack for courting controversy.
But did Mahmoud Ahmadinejad, who is often accused of political naivety and recklessness, fully anticipate the repercussions of his visit to the disputed Gulf island of Abu Musa last week?
His jaunt was certainly ill-timed, coming on the eve of Iran's resumption of stalled nuclear talks with six world powers, including the United States.
Struggling against tightening sanctions and threatened by an Israeli military attack, it might have been smarter for Iran's leader to speak softly and make friends.
Instead, by visiting Abu Musa, Mr Ahmadinejad "has given more ammunition" to Iran's Gulf Arab neighbours "to support sanctions and become even more suspicious of the motivations and the role of the Iranian regime in the region," said Meir Javedanfar, an Iranian-born Iran expert.
The six-nation Gulf Cooperation Council (GCC) on Tuesday condemned Mr Ahmadinejad's "provocative" visit as a "flagrant violation" of the UAE's sovereignty.
Scott Lucas, an Iran specialist at Birmingham University in England, doubted Iran had been "trying to pick a fight" with the UAE, noting that Iran's state-run media initially had paid little attention to their president's April 11 trip.
But most analysts believe Mr Ahmadinejad knew exactly what he was doing.
He was the first Iranian leader to visit Abu Musa since Iran, then ruled by the US-backed Shah, seized it in 1971 when Britain granted independence to its Gulf protectorates and withdrew its forces from the region. With it, Iran took control of two other tiny Gulf islands, Greater Tunb and Lesser Tunb, which are also claimed by the UAE.
Mr Ahmadinejad wanted to send a message to the Gulf countries that "any support they show the United States, especially in terms of sanctions, could be counterproductive," Mr Javedanfar said in an interview.
Tehran is frustrated that Abu Dhabi has pressed Dubai to close sanctions loopholes against Iran, and is angered by the UAE's opposition to Iran's nuclear programme. Tehran is also furious with the GCC's robust opposition to Syria's President Bashar Al Assad, Tehran's only state ally in the region.
Anoush Ehteshami, an Iran expert at Durham University in England, said Mr Ahmadinejad was showing "that he's president, that he can do what he likes as head of state and that the neighbours will have to watch what Iranians do".
Many experts believe Mr Ahmadinejad's prime motivation in visiting Abu Musa was to bolster his standing at home. This has been significantly weakened since his supporters were trounced in parliamentary elections last month by loyalists of his more powerful rival, Iran's supreme leader, Ayatollah Ali Khamenei.
"Ahmadinejad has been trying to build up a new constituency of his own Ö We've seen a trend in which he has tried to play the nationalist card," said Trita Parsi, a leading Iran analyst in the US.
Mr Javedanfar agreed: "His economic policies have been failures but he knows the one place he can win, where he can prop up his popularity, is by stirring up nationalistic fervour."
The Iranian president is reaping some political dividends at home, even if some critics might privately view his Abu Musa trip as a self-serving venture at odds with Iran's best interests.
His opponents have rallied behind his right to visit the tiny island on a "provincial tour" and condemned the hue and cry in the Arab world as interference in Iran's "internal" affairs.
Mohsen Rezaie, an influential political rival of the Iranian president and former commander of Iran's Revolutionary Guards, warned: "The UAE authorities should not echo the Zionists' [Israel's] voice."
Prominent Iranian lawmakers, many with little love for Mr Ahmadinejad, joined in with calls for the regime to take a robust stand against the UAE and its "baseless" claims to the three islands. Some recommended cutting economic, trade and tourism ties.
"When these guys are facing a lot of domestic or internal problems, in the face of an issue like this [the dispute with the UAE], they can't afford not to be united," Mr Parsi said in an interview.
Iran declared on Wednesday its ownership of the three islands was "non-negotiable".
Touring far-flung parts of Iran with a large entourage has been a hallmark of Mr Ahmadinejad's seven years in office. These trips are often criticised by his rivals, who accuse him of squandering state money and making lavish promises to the rural poor to secure their political support.
There was no such criticism last week. Anger was instead directed against the UAE.
Mr Javedanfar said: "Ahmadinejad's timing was wrong in terms of Iran's foreign policy, but in terms of his domestic policy it was right."
An analyst in Tehran, who requested anonymity, said Mr Ahmadinejad can now boast he is the first Iranian head of state in to visit Abu Musa, and that he dared do so at a time of unprecedented international pressure.