Iranian President Mahmoud Ahmadinejad caved into pressure from hardline clerics and the country's supreme leader Friday and allowed the resignation of his top deputy after a week-long standoff.

For days, the president had resisted pressure from hard-liners, including a direct order from the supreme leader Ayatollah Ali Khamenei, to dismiss his choice for the key post of first vice president, Esfandiar Rahim Mashai, who last year angered conservatives when he made friendly comments toward Israel.

The final blow, however, appeared to be the public reading on state television of the order issued earlier by Khamenei to dismiss Mashai because he is "contrary to the interest of you and the government."

The issue created a rare rift between Ahmadinejad and the hard-liners that form the bedrock of his support and comes at a particular sensitive time as he is battling opposition reformists who accuse him of winning the June 12 presidential elections through fraud.

"After the announcement of the exalted supreme leader's order, Mashai doesn't consider himself first vice president," IRNA quoted presidential aide Mojtaba Samareh Hashemi as saying late Friday.

The resignation capped a day of renewed pressure that featured conservative student street demonstrations and Friday sermons railing against Mashai's appointment.

Despite all the pressure, Ahmadinejad had pleaded for more time to explain his reasons for choosing a man he had described as a "pious, caring, honest and creative caretaker for Iran." Mashai's son is also married to the president's daughter.

The president even continued to back his man after his greatest supporter and the supreme leader of the country issued a private order Monday telling him that the appointment "causes a rift and disillusionment among your supporters. The aforementioned appointment must be canceled and consider it null and void."

Reading the order publicly Friday dramatically increased the pressure on Ahmadinejad, and further refusal to act would have amounted to a flagrant and public defiance of the supreme leader.

The issue was also the topic of the main Friday prayer sermon in Tehran. Ayatollah Ahmad Khatami said that "now that he (Khamenei) has expressed his opinion, there is no room for delay anymore."

Khamenei has the final say over all state matters and has rarely faced defiance in the past. That changed following last month's election when supporters of opposition leader Mir Hossein Mousavi challenged Khamenei's ruling that the June 12 vote was fair.

The flap over the vice presidency appears to signal a move by Khamenei to entrench for himself an even more unquestionable status in the face of the reformist threat. By demanding Mashai's removal, Khamenei is effectively appropriating a new power, since normally the supreme leader does not intervene openly to remove a government official, though he is believed to often vet appointments behind the scenes.

The president's brief defiance may have been out of fear of an attempt by hard-liners to dictate the government he is due to form next month.

Mashai angered hard-liners in 2008 when he said Iranians were "friends of all people in the world — even Israelis." He was serving as vice president in charge of tourism and cultural heritage at the time.

Iran has 12 vice presidents, but the first vice president is the most important because he succeeds the president if he dies, is incapacitated, steps down or is removed. The first vice president also leads Cabinet meetings in the absence of the president.

Hard-line students protesting in the streets Friday warned Ahmadinejad that they will withdraw their support unless he dismisses Mashai.

"Obeying the leader's order is the demand of the nation," they chanted.