Gen. Stanley McChrystal, fired from his job as commander of the Afghanistan war after more than three decades in the Army, will be allowed to retire at the rank of four stars.

White House spokesman Robert Gibbs said Tuesday that the White House will do what it can to ensure McChrystal keeps that rank. McChrystal had been a four-star general for just over a year when President Barack Obama demanded his resignation as Afghan war commander because of scornful remarks made to Rolling Stone magazine.

Under Army rules, McChrystal would have had to serve three years as a four-star officer to retain that rank, with its higher prestige and deeper retirement benefits.

The Army has been 55-year-old McChrystal's only career. He is being replaced by Gen. David Petraeus, who was his boss at U.S. Central Command.

At his confirmation hearing Tuesday, Petraeus used his opening remarks to pay tribute to his former colleague. Petraeus said McChrystal's leadership has contributed directly to the success in Iraq and Afghanistan.

"We now see some areas of progress amidst the tough fight ongoing in Afghanistan," Petraeus said. "Considerable credit for that must go to Stan McChrystal."

(This version CORRECTS to show that McChrystal was a four-star general for just over a year, not for less than a year.)