Iran's supreme leader Ayatollah Ali Khamenei has replaced the head of the Revolutionary Guards, just two weeks after the US said it was planning to list the force as a terrorist organisation.
State television said on Saturday that General Yahya Rahim Safavi would be replaced by Mohammad Ali Jaafari, another senior commander of the elite force.
"Acknowledging General Safavi's 28 years of honest service in different military fields and 10 years of successful leadership of the Revolutionary Guards, I appoint you top adviser in military affairs," a decree from Khamenei said.
The Revolutionary Guards, which is estimated to have at least 100,000 troops, answers directly to Khamenei and is seen as a defender of the 1979 Islamic revolution that forced out the Shah and founded the current religious republic.
Khamenei thanked Safavi for his "valuable" service and advised his successor to highlight the "increasing progress" of the Guards.
"Everybody is totally taken by surprise by this announcement," Ali Reza Ronaghi, Al Jazeera's correspondent in Tehran, said.
"The Iranian supreme leader has appointed the former commander in chief of the Revolutionary Guards as his assistant and adviser. This is a decoration, it is like giving him a medal, but at the same time he has been demoted."
In an interview last month, Safavi explained the role of the Guards, which has land, sea and air forces.
"We are a major offensive and defensive power in the Middle East. We have trained and equipped our forces with the latest equipment to defend our soil," he said.
But the force has extended its influence beyond the military in recent years.
Its engineering subsidiary Khatam al-Anbia has picked up important oil and gas contracts, while former officials have moved into crucial political positions.
Mahmoud Ahmadinejad, the Iranian president, fought for the Revolutionary Guards during the 1980-1988 war with Iraq, and after taking office in 2005 promoted five former Guards members into cabinet posts.
If Washington were to carry out its threat to blacklist the Guards it would enable it to target the group's finances.
Safavi responded to the White House's announcement by saying that the Guards would retaliate against attempts to register it as a terrorist organisation.
"America will receive a heavier punch from the guards in the future," he was quoted as saying on August 16 by the Kayhan newspaper.
"We will never remain silent in the face of US pressure and we will use our leverage against them."
Jaafari - who was a Guards commander during the 1980-1988 war against Iraq - has since worked as head of the Guards' Strategic Centre since 2005 and also commanded its ground forces.