With poisonous rhetoric he was, for some, a convenient bogeyman that made negotiation impossible.
But what will be the lasting legacy of a man who has been Western leaders' villain of choice in recent years?
Iranian blogger Potkin Azarmehr told The Huffington Post UK: "He will be remembered as someone very controversial, and someone who - and I never thought I would say this - was one of the few people who managed to stand up to the Supreme Leader.
The President was often 'at loggerheads' with the Iranian regime
"Other than that, economically he was an absolute disaster.
"And in terms of Iran's standing in the world, and relationship with the mainstream world, an absolute disaster."
In many ways, Ahmadinejad was more popular outside Iran than inside the country, Azarmehr said.
"Quite often you come across someone in the outside world, a taxi driver, someone in a shop, and they seem to have a completely different perception of what he is like," he said.
For Mahan Abedin, a UK-based Iranian political anaylist, Ahmadinejad has been "the most controversial and, arguably the most prolific, President in the Republic's history."
'He was not a statesman'
Ahmadinejad "broke the mould", Adebin said, as the first non-clerical president, after he exploded onto the scene as mayor of Tehran.
"He deviated from conventional wisdom at the outset that he would toe the party line.
"His ambition to make his mark on the world stage was very interesting and quite new."
But in taking on the Iranian establishment he met his match.
"He seriously over-estimated his own strengths, and under-estimated the strengths of the opposition...he doesn't really have an independent power base inside the regime."
Ahmadinejad's Most Outrageous Quotes On 9/11, Israel And The Holocaust Ahmadinejad, Kim Jong Ill And The End Of The 'Bad Guy' Generation Iranian Election Candidate Queried on Academic Credentials Iran's Election: A Choice Between Satan and the Devil?
From 2011 onwards, Ahmadinejad found himself at "loggerheads" with the power-brokers, Abedin said.
Meanwhile, he was trying to portray himself as a champion of the Iranian people.
For Abedin, as far as his legacy within Iran is concerned, "the middle classes despise him.
"But some sections of the working classes do like him."
As his speeches to the UN proved, Ahmadinejad did not shy away from hostile political situations.
He was "a witty and capable politician," Abedin said.
"But he didn't have the features of a true statesman.
"He was a gut-instinct, street-level politician.
"I don't think we will be talking about him in years to come, because he did not have statesman-like qualities."