TEHRAN, Iran - Mock condolences arriving by text message in Iran announce the political "death" of President Mahmoud Ahmadinejad. Memorial services, the joke continues, are planned at the United Nations.

The satire may bring smirks from the many foes Ahmadinejad has racked up over eight years in office, stemming from several high-profile feuds with the ruling clerics and one disputed re-election.

But no one is truly counting Ahmadinejad out of Iran's political future, which could face some bumpy times as he decides his next moves and his opponents plot possible payback.

One way or another, the combative and polarizing aura of the soon-to-be former president is not going to dissipate once his centrist successor, Hasan Rouhani, is sworn in Aug. 4.

Ahmadinejad has remained evasive on his post-presidential plans. Speculation, however, is fanning out in several directions, including media boss and freelance statesman. A trip to Iraq this week - one of his last major moments in the spotlight as president - will be watched closely for clues on his next moves.

"The only thing that's certain at this point is that Ahmadinejad and his team are just not going to pack up and go away," said Rasool Nafisi, an Iranian affairs analyst at Strayer University in Virginia. "Iran's political system has to be prepared for that."

Thus Ahmadinejad's departure is a potential shock to Iran's system. Since turbulent shakeouts immediately after the 1979 Islamic Revolution, Iran's other former presidents have remained rooted in the system. Ayatollah Ali Khamenei, who left the presidency in 1989, rose to become supreme leader. His successor, Akbar Hashemi Rafsanjani, took posts within the ruling clerics. Even reformist Mohammad Khatami was careful not to fight back too hard over sweeping crackdowns on the opposition and some of the freedoms he helped engineer.

But Ahmadinejad has essentially become a political orphan.

The ruling establishment holds a powerful grudge over his maverick-style challenges to Khamenei's authority to set policies and pick key Cabinet posts, which left Ahmadinejad severely weakened in recent years.

Liberals long ago rejected Ahmadinejad's firebrand ways, which included anti-Israeli diatribes and questions over the Holocaust that also hammered his image in the West. And many former conservative backers drifted away when it became a loyalty test between either Ahmadinejad or the supreme leader.

This leaves Ahmadinejad with a small cadre of allies and pockets of supporters around the country - mainly poor and rural Iranians grateful for his government's monthly handouts.

How he may leverage this remaining clout "is very difficult to predict," said Ali Bigdeli, a professor in international relations in Tehran's Beheshti University.

One intriguing hint was given last week by his closest aide, Esfandiar Rahim Mashaei, who said it was "likely" Ahmadinejad could launch a media outlet.

"We are not considering formation of a political party," said Mashaei, who was barred by the ruling clerics from the ballot in June's election as part of the high-level fallout against Ahmadinejad. "But the media can be effective. The society needs media."