"I consider your excellency a competent, wise, honest man," Ahmadinejad said in a statement posted on his office's website. "Knowing and working with you is a divine gift and a great honor for me."
In contrast, Ahmadinejad released a very short separate statement to appoint Hasan Mousavi as Mashaei's successor to the post of the president's chief of staff.
Mashaei was at the heart of the dispute from the first day of Ahmadinejad's re-election in 2009 when the president appointed him as his first vice president. Khamenei quickly stepped in and pressured Ahmadinejad to drop the appointment, and Mashaei was gone within the week in a stinging embarrassment to the president.
Ahmadinejad has widely been quoted in Iranian media as privately saying that it would be an honor for him to serve as first vice president under Mashaei.
Even with the president's support, it is unclear whether Mashaei, if he chooses to run, will make it onto the presidential ballot. All candidates in the elections must be approved by the hardline Guardian Council, a body whose key members are handpicked by Khamenei.
Many conservatives say Mashaei will likely be barred from running but others believe it could be a tough challenge for the ruling system to disqualify him from the vote.