Profile: Robert Gates
Robert Gates, the 22nd Secretary of Defence, was the only member of George W Bush's cabinet to remain in office after President Barack Obama took charge in January 2009.
Mr Obama tasked him with winding down the war in Iraq and curbing the surging violence in Afghanistan. And he gave him another challenge to match the first two: reshaping the Pentagon's budget, bloated after years of gains following the September 11 terrorist attacks in 2001.
The US is set to withdraw the last combat troops from Iraq in August 2010, while coalition casualties in Afghanistan have risen dramatically since Mr Obama took office.
Meanwhile, Mr Gates has proposed slashing by at least 50 the number of generals and admirals, cutting 10% of private contractors, and eliminating an entire major military command in Virginia.
He has also sought to cut what he and Mr Obama have said are wasteful redundancies in aircraft and other weapons programmes.Bipartisan plaudits
But Mr Gates' effort has run into significant resistance from powerful members of the US Congress who depend on military spending for jobs in their districts.
Since becoming defence secretary, Mr Gates has won plaudits from both sides of the aisle for his handling of the troop surge in Iraq, and has been given credit for the decline in violence in the country.
He took the job in at a particularly low ebb in the US involvement in Iraq.
His reluctance was evident at a Senate confirmation hearing in December 2006 when he told senators: "I did not want this job. I'm doing it because I love my country."
At the time, he told senators that the US was not winning the war and a change of tactics was needed.
"We're fighting against terrorism worldwide and we face other serious challenges to peace and our security. I believe the outcome of these conflicts will shape our world for decades to come," Mr Gates said when first nominated.
Mr Gates had been a member of the Iraq Study Group, led by his former colleague James Baker, which had suggested major changes to US policy in Iraq.
But as defence secretary, he carried out President George W Bush's orders to send more troops to the country, and was respected by military leaders, as well as by his political masters in Washington.CIA career
Mr Gates has experience in both intelligence and covert action.
He played a key role in US policy in the first Gulf War, in the negotiations over the Iran hostage crisis, and in the US response to the Soviet invasion of Afghanistan.
And he was credited with rebuilding morale at the CIA after a series of congressional investigations in the 1970s and 1980s.
The appointment of Mr Gates, who was also a member of Mr Bush's father's administration, signalled a return to a more realist approach to US foreign policy, rather than the neo-conservative approach backed by his predecessor Donald Rumsfeld, one of the architects of the Iraq war.
Mr Gates spent most of his career as an official at the Central Intelligence Agency, where he rose to become director of the agency under the first President Bush in 1991, a position he held until 1993. Mr Gates was the only career officer in CIA history to rise from an entry-level position to lead the agency.
Mr Gates' early career was dogged with controversy, particularly over the Iran-Contra issue in the 1980s, and his first nomination as CIA director was withdrawn by Ronald Reagan in 1987.
Before he became defence secretary in 2006, Mr Gates was the president of Texas A&M University, one of the largest universities in the US.Iran-Contra
Robert Gates was born in Wichita, Kansas and joined the CIA in 1966 after attending the College of William and Mary and completing graduate work at Indiana University. He later received a PhD in Russian and Soviet history from Georgetown.
Mr Gates also served on the White House national security staff in 1974-79.
But the most controversial moment in his career was the 1982-86 period during his rise through the CIA's top echelons to become acting director.
As such, he was in a position to know about the so-called Iran-Contra scandal, which involved the illegal diversion of funds from the sale of arms to Iran to fund the Contras in their fight against the left-wing Sandinistas who had taken power in Nicaragua.
Mr Gates was investigated by the office of the independent counsel in 1991 but was never prosecuted for any offence.
He was also deputy national security adviser to the first President Bush.Cold warrior
In his book, From the Shadows, published in 1996, Mr Gates defended the role of the CIA in undertaking covert action which, he argued, helped to win the Cold War.
In a speech in 1999, Mr Gates said that its most important role was in Afghanistan.
"CIA had important successes in covert action. Perhaps the most consequential of all was Afghanistan where CIA, with its management, funnelled billions of dollars in supplies and weapons to the mujahideen, and the resistance was thus able to fight the vaunted Soviet army to a standoff and eventually force a political decision to withdraw," he said.
He has served six presidents.
Mr Gates has been awarded many honours by the US government, including the National Security Medal, the Presidential Citizens' Medal, and the National Intelligence Distinguished Service Medal.