No official reason was given for the sacking of Gholam-Hossein Mohseni-Ejei, the intelligence minister, but the Mehr news agency quoted an unnamed source as saying it was due to differences with Ahmadinejad over his decision to appoint Esfandiar Rahim-Mashaei as first vice president.
Mashaei has become a lightning rod for contention after making remarks that Iran's problems with Israel have nothing to do with the Israeli people or Jews in general.
Mashaei, who is the father-in-law to Ahmadinejad's son, stepped down on Saturday after Ayatollah Ali Khamenei, Iran's supreme religious leader, ordered Ahmadinejad to fire him.
But Ahmadinejad re-appointed Mashaei as his adviser. Local media reports said Ahmadinejad and the two ministers had an angry argument in a cabinet session earlier this week over the disputed appointment.
Mohseni-Ejei and Saffar-Harandi had reportedly called on the president to give in to the protests and revise the appointment but Ahmadinejad harshly rejected their demand. In protest, Mohseni-Ejei and Safar Harandi left the cabinet session.
Ahmadinejad is scheduled to be sworn in as president on August 5 and introduce his new government members until the end of next month.
The parliament has to approve all ministers. Due to the quarrel between Ahmadinejad and the parliament over the acting president, observers expect heated discussions over the new cabinet members as well.