Last March, Iran's President Mahmoud Ahmadinejad was summoned by an angry parliament to answer questions about his economic policies, a banking fraud perpetrated by some of his allies, and his defiance of Supreme Leader Ayatollah Ali Khamenei. Mr Ahmadinejad made light of the questions, delivered irreverent one-liners, and questioned the intelligence of the MPs - most of whom hail from conservative and hard-line camps.
The parliamentary showdown, aired live on state radio, offered a window into the power struggle between Mr Ahmadinejad and his former allies in the conservative camp, most of whom stood firmly behind the president in his controversial 2009 "re-election" that resulted in massive street protests amid allegations of fraud. By March 2012, Mr Ahmadinejad had few allies left.
Mr Ahmadinejad might have remembered that parliamentary showdown amid the rough treatment last week as the Iranian rial collapsed, angry protesters called him a traitor and he faced yet another round of bashing from hardliners and conservatives in parliament and in the media.
In March, parliament was so infuriated by the president's behaviour that many openly talked of impeaching him. Ayatollah Khamenei, the most powerful figure in Iran and the man who had given a green light to the conservative establishment to unleash attacks on Mr Ahmadinejad, pulled the parliament back from impeachment, it is believed.
Today, Mr Ahmadinejad may wish parliament had gone through with the impeachment after all. That way he would have been a political martyr rather than a failed president, battered and beaten, sneered at by the international community and jeered at by one-time allies, in his last year in office.
Mr Ahmadinejad stormed into office in 2005 with a populist message that the system should be cleansed of corruption and that ordinary Iranians deserved a greater share of the economic pie. He was right on both counts, but failed to deliver on either.
His own aides proved adept at corruption and his economic policies produced chronic inflation, stagnant wages, industrial disinvestment, capital flight and listless growth - despite historically high oil prices.
"The man of the people" failed to deliver, while some of his own people grew fabulously rich. Meanwhile, his political challenge to the power of the Supreme Leader proved nearly fatal. Just ask dozens of his top aides who have been jailed or intimidated over the past two years, including the media figure Abbas Javanfekr, who was taken to prison on the same day Mr Ahmadinejad delivered remarks to the General Assembly last month.
In the foreign policy arena, Mr Ahmadinejad's era was marked by an extraordinary fall in Iran's international standing and the steady deterioration of diplomatic relationships worldwide. Presidents Hashemi Rafsanjani (1989-97) and Muhammad Khatami (1997-2005) both presided over eras in which Iran consistently improved its relations with its neighbours and the wider world. The Khatami era, in particular, was a time of bridge-building with the Arab states and Europe.
The Ahmadinejad era tore up those bridges and has left Iran isolated and lacking in powerful allies. Even Russia and China are fair-weather allies. Russia has little reason to want gas-rich Iran to be unburdened of sanctions; Iran's gas is best left in the ground, as far as Moscow is concerned. China drags its feet on investments in Iran's oil and gas sector, spending minimal amounts, while pouring tens of billions of dollars into resource-rich emerging markets and tiny African countries.
Meanwhile, Mr Ahmadinejad's love affair with Latin American leftist leaders makes for good TV, but does little to bolster Iran's strategic interest.
In the Arab world, in particular, the president's personal style grated on regional heads of state. Mr Khatami's personal diplomacy - not just Iran's policies alone - proved critical in improving diplomatic ties across the region.
Finally, Mr Ahmadinejad's incendiary, bombastic, conspiratorial, and sometimes clownish rhetoric has served neither him nor his country well. Iran sits at the bottom of most global public attitude polls from BBC to Pew Surveys on "negative" country ratings, alongside North Korea, Pakistan and Israel.
Mr Ahmadinejad will depart the presidency in the summer of 2013. His character and history suggest he will not leave the political scene quietly. But for a man who stormed onto the global arena with so much thunder and chest-thumping pride, he leaves behind a trail of destruction that has left Iranians endangered by a deteriorating economy and a geopolitical environment that has left the country isolated and lacking meaningful allies.
Mr Ahmadinejad has put on quite a show, but it's not one that Iranians will remember fondly.
Afshin Molavi is a senior adviser at Oxford Analytica, a global advisory and analysis firm
On Twitter: @afshinmolavi