TEHRAN, Iran (CNN) -- Iran's newly appointed -- and controversial -- first vice president has resigned, the semi-official Fars News Agency reported Friday.
Esfandyar Rahim Mashaie, left, has a daughter who is married to Mahmoud Ahmadinejad's son.
Esfandyar Rahim Mashaie "has declared that according to the order [from the nation's supreme leader] from this moment on I do not consider myself to be the 1st VP. I am prepared to serve the Revolution in any place that I can," Fars reported, quoting Mojtaba Hashemi Samareh, senior adviser to President Mahmoud Ahmadinejad.
Earlier, the supreme leader, Grand Ayatollah Ali Khamenei, sent a letter to Ahmadinejad saying "it is necessary" to declare Mashaie's appointment "null and void," Fars reported.
Such a choice is "against your interests and the interests of the government and has caused disappointment among your friends," Khamenei said, according to Fars.
Mashaie has been controversial because of comments he reportedly made last year that the Iranian people are friends with all people, including Israelis. Critics also found fault with Mashaie for reportedly not leaving an area in Turkey where female dancers were performing.
Mashaie's daughter is married to Ahmadinejad's son. Ahmadinejad has defended Mashaie despite the criticism surrounding the appointment. He is among the Iranian president's closest confidants, and he was previously the head of the Cultural Heritage, Handicrafts and Tourism Organization, Fars reported.
And the appointment to the position reflected that closeness. Although there are 12 vice presidents in Iran, the first vice president is the only one who can lead a Cabinet meeting if Ahmadinejad is unable to do so.
Other news reports said that that other Iranian voices had come out against Mashaie, including rightist lawmakers, the Council of Experts and clerics. Ayatollah Seyed Ahmad Khatami said in a sermon during Friday prayers that Ahmadinejad should rethink Mashaie's appointment, Fars said.
The ayatollah said he regarded the present government to be legal, a reflection of his support for Ahmadinejad, whose controversial victory in last month's presidential elections stoked widespread unrest in Iran.
But he urged Ahmadinejad "to heed the advice of his friends."
"We consider this government to be legal and support it, but based on our fondness for the president we ask that he reconsiders his appointment of the first vice president," the ayatollah said.
At Friday prayers, Khatami reportedly said "we would like" Ahmadinejad "to remain a powerful and popular president."
"We wish that there would have been no need for the supreme leader to express an opinion in this regard. But now that he has, his opinion must be heeded immediately because the legality of all things in the Islamic System [of government] comes from the supreme leader."
CNN's Shirzad Bozorgmehr contributed to this report.