Ahmadinejad on Saturday broke off from the pack to capture second place and a spot in next week's runoff race for president.
Just two years ago Ahmadinejad, 49, was a little-known figure in Iranian politics. Then he became Tehran's mayor, put there by the rigidly conservative city council.
He is a former Islamic Revolutionary Guard commander, unabashedly conservative and loyal to Iran's Supreme leader Ayat Allah Ali Khamenei.
He is seen by many who voted for him as one ready to stand up to the United States. "I picked Ahmadinejad to slap America in the face," Mahdi Mirmalek said after casting a ballot for the Tehran mayor.
US embassy siege
As a young student, Ahmadinejad joined an ultraconservative faction of the Office for Strengthening Unity, the radical student group spawned by the 1979 Islamic Revolution and staged the capture of the US Embassy.
According to reports, Ahmadinejad attended planning meetings for the US Embassy takeover and at these meetings lobbied for a simultaneous takeover of the Soviet Embassy.
In a wide-ranging interview with the state run Islamic Republic of Iran Broadcasting (IRIB) just days before Friday's elections, Ahmadinejad slammed the United Nations as "one-sided, stacked against the world of Islam".
"I picked Ahmadinejad to slap America in the face"
He opposed the veto vote by the five permanent members of the UN Security Council.
Wanting the veto
"It is not just for a few states to sit and veto global approvals. Should such a privilege continue to exist, the Muslim world with a population of nearly 1.5 billion should be extended the same privilege," Ahmadinejad was quoted by IRIB as saying.
"Global equations undergo changes, this is their nature, and today the Muslim world is the poorest of the global powers," he told IRIB.
He called for greater ties with Iran's neighbours, an end to visas between states in the region, saying: "People should visit anywhere they wish freely. People should have freedom in their pilgrimages and tours."
He defended Iran's nuclear power programme and accused "a few arrogant powers", a reference meant to include the US, of seeking to limit Iran's industrial and technological development.
Ahmadinejad graduated in civil engineering from Iran University of Science & Technology.
He is best known for his simple attire and unpolished style. One of seven children, he was born to a middle-class family in Garmsar, a neighbourhood southeast of Tehran.
Ahmadinejad is known for his
When Iraq invaded Iran, Ahmadinejad volunteered for military service, joined the Revolutionary Guards and was considered a daring soldier, participating in several military operations deep within Iraq, according to information posted on his website.
With the war behind him, Ahmadinejad went into politics, was appointed governor first of Maku in northwestern Iran and later governor of the newly created province of Ardabil.
Two years ago hardliners installed him as Tehran's mayor. After just two years as Tehran mayor, Ahmadinejad was nominated for World Mayor 2005, a UK-based site aimed at raising the profile of mayors worldwide "as well as to honour those who have served their communities", according to the site.
Of the 550 mayors nominated via email, Ahmadinejad made it to a finalist of 65 mayors, of which only nine are from Asia. The finalists are apparently determined by the quality of the comments attached to the nominations.