General David Petraeus warned against sacrificing US military capabilities to ease America's budget woes, as he retired from the Army today ahead of becoming CIA director.
Gen Petraeus (58) rose through the ranks to become arguably the US military's brightest star, credited for helping to turn around the Iraq war and for helping to halt the momentum of Taliban militants in Afghanistan. He led US troops in both conflicts and briefly oversaw the entire the region as head of the military's Central Command.
"Dave has, over the last decade, advised two presidents, changed the course of two wars, transformed our military, and perhaps most important of all, reminded Americans once again, that with the right ideas and the right leadership, almost anything is possible," admiral Mike Mullen, chairman of the Joint Chiefs of Staff, said at the retirement ceremony.
Mr Mullen added: "Afghanistan is now a more secure and hopeful place than a year ago."
At the CIA, Petraeus will replace Leon Panetta, who became US defense secretary. He will be sworn in next Tuesday.
Gen Petraeus acknowledged he was leaving the military at a delicate moment, as the Pentagon seeks ways to cut some $350 billion over the next decade. Some lawmakers want even deeper cuts, which top brass warn will affect missions the military can carry out.
"As our nation contemplates difficult budget decisions, I know that our leaders will remember that our people, our men and women in uniform are our military," Gen Petraeus said, adding that "taking care of them and their families must be our paramount objective."
He also warned it was important to maintain the "versatility and flexibility" developed during the past decade of counter-insurgency conflicts.
Gen Petraeus said that the September 11th, 2001 attacks, which triggered a decade of war, were a reminder that "we don't always get to fight the wars for which we are most prepared, or most inclined."
"Given that reality, we will need to maintain the full-spectrum capability that we have developed over this last decade of conflict in Iraq, Afghanistan or elsewhere," he said.
Gen Petraeus' decision to retire from the Army is meant to ease the transition as CIA director, although the lines between US military and covert CIA operations have blurred in recent years in the battle against al-Qaeda.
As intelligence chief, Gen Petraeus is expected to embrace the CIA's covert drone strikes in Pakistan.
Gen Petraeus has also dismissed concerns he would be unable to provide objective intelligence advice on the wars in Afghanistan and Iraq, after leading those campaigns.