An engineer and teacher from a poor background, ideologically shaped by thinkers such as Navvab Safavi, Jalal Al-e-Ahmad and Ahmad Fardid, Ahmadinejad joined the Office for Strengthening Unity after the Iranian Revolution. Appointed a provincial governor in 1993, he was replaced along with all other provincial governors in 1997 after the election of President Mohammad Khatami and returned to teaching. Tehran's council elected him mayor in 2003. He took a religious hard line, reversing reforms of previous moderate mayors. His 2005 presidential campaign, supported by the Alliance of Builders of Islamic Iran, garnered 62% of the runoff election votes, and he became president on 3 August 2005.