There were no advance hints of the shake-up, and a terse announcement carried by state media gave no reason for it.

Image Gen. Hassan Firouzabadi in 2010. He was replaced as chief of staff of the Iranian armed forces on Tuesday. Credit... Atta Kenare/Agence France-Presse — Getty Images

On June 16, General Firouzabadi appointed a set of new advisers. He had been struggling with obesity and was rumored to have undergone at least one operation to lose weight. Health issues could be a reason for his dismissal, analysts said. General Firouzabadi will now serve as a senior adviser to Ayatollah Khamenei, state television reported.

General Firouzabadi was one of the few military supporters of Mr. Rouhani, elected three years ago, and was among the first to speak out in favor of the nuclear agreement reached with world powers.

In his regular speeches, the general often echoed statements of Ayatollah Khamenei, who frequently warned against trusting the nuclear agreement’s Western partners, most notably the United States.

In 2012, the general verbally attacked Israel’s right to exist, saying, “The Iranian nation stands for its cause, which is the full annihilation of Israel.”