WASHINGTON (AP) — Several days before Robert Gates took over as defense secretary in December 2006, it struck him that the job's most punishing pressure would not come from the White House, Capitol Hill or inside the Pentagon.
From a chance encounter with a military mom, he realized that his heaviest burden as Pentagon chief would be his own emotions, the inescapable worry about the thousands of young American men and women he would send to fight and die on foreign battlefields.
"She said, 'I have two sons in Iraq. For God's sake, bring them home safe. And we'll be praying for you.' Now that's real pressure," he told the Senate committee that was considering his nomination.
It is pressure that, 4½ years later, he readily acknowledges has taken a heavy toll. In a sense it has been a defining feature of his tenure, not the personal strain itself but how it influenced his priorities in the job. Gates' tenure is one of the few in history to have begun and ended in wartime.
"One of the interesting challenges about this job has been the responsibility of waging two wars, neither of which I had anything to do with starting," Gates mused during his final scheduled news conference last week. He's retiring June 30.
Wars in Iraq and Afghanistan began in the first term of President George W. Bush, who hired Gates in 2006 to turn around the flagging and increasingly unpopular U.S.-led war in Iraq. Afghanistan was a footnote then, a small war begun in 2001 but largely orphaned to pay for the large invasion of Iraq two years later.
The wars spanned Gates' entire tenure, under Bush and Democrat Barack Obama, and the wars are outlasting him.
As he repeatedly told soldiers and Marines on his 12th and final trip to Afghanistan in early June, he felt a personal responsibility to do whatever possible in Washington to improve their chances of survival in combat and, for those wounded or injured, to provide the fastest possible evacuation from the battlefield for treatment.
Gates came to the conclusion early in his tenure that the Pentagon bureaucracy, including the military's top brass, were too focused on preparing for the next war, spinning out plans for high-tech, costly new weapons for use against theoretical enemies of the future, rather than focusing on winning the current wars.
So he pushed hard against internal resistance to speeding production and delivery of a new type of ground combat vehicle that reduces the vulnerability of infantry to roadside bombs.
He irked the Air Force leadership when he insisted they get more surveillance drones over the battlefields. In a public rebuke in April 2008 he told the Air War College that getting the Air Force to do more was "like pulling teeth."
When Gates' legacy is sorted out over time, the gains he made in troop protection surely will figure prominently.
So, too, will several pieces of unfinished business, including Iraq and Afghanistan and the deteriorating relationship with Pakistan, arguably Washington's most important partner in the struggle against al-Qaida.
Gates gave little indication during his new conference that he is hopeful about Pakistan. He worked to rebuild trust between the U.S. and Pakistani militaries, but saw the relationship sour badly over the past several months. He leaves office with relations at a nadir over the U.S. raid that killed Osama bin Laden at a comfortable compound inside Pakistan.
"The things that would cause an (improvement in relations) are hard to predict right now," Gates said Thursday.
Gates arrived at the Pentagon on Dec. 18, 2006, as successor to Defense secretary Donald H. Rumsfeld, who quit in the wake of a Republican beating in that November's congressional elections. The war in Iraq was failing, and many in Congress were demanding a quick exit.
Almost no one was predicting what came to pass during Gates' first two years on the job: insurgent and sectarian violence in Iraq plummeted and the war effort assumed the look of at least a short-term success.
It will be for historians to decide how much credit Gates deserves for turning around that war. He was not involved in developing the strategy that Bush announced in January 2007 when he committed additional troops to Iraq. But Gates oversaw its execution by Army Gen. David Petraeus in Baghdad.
Gates, 67, came to the Pentagon job from the presidency of Texas A&M University. He initially retired from government service in 1993 after a 27-year career at the CIA, where he became the first entry-level employee to rise to the position of director of the spy agency.
Bush recruited him to return to Washington, mainly to oversee the stepped-up Iraq war effort. Gates made no secret of his reluctance. He carried with him a clock counting down Bush's remaining days in office, a not-so-subtle signal of his impatience to get back to retirement and leave Washington's battles behind.
But Obama talked Gates into staying on, making him the only defense secretary to be retained by a new administration. Out went the countdown clock. "It was absolutely useless," Gates chuckled.
Even as Iraq began to look better, the picture in Afghanistan grew darker.
The Taliban were on the rebound, and by spring 2009 Gates was recommending to Obama that he fire his commander there, Army Gen. David McKiernan, to put "fresh eyes" on a stalemated war. The chosen successor, Army Gen. Stanley McChrystal, lasted barely a year, done in by indiscreet comments in a magazine article. Petraeus then replaced McChrystal.
When Gates retires on June 30, there will be nearly 50,000 U.S. troops in Iraq and about 100,000 in Afghanistan. While Iraq has achieved relative stability since Gates took over, the prospects for a durable peace are uncertain.
The outlook in Afghanistan is even murkier, although the U.S. and its NATO partners have set a target date of Dec. 31, 2014, for withdrawing all their combat forces and putting Afghans fully in charge.
War statistics tell part of the story of Gates' heavy focus on the human toll.
On the day of his Senate confirmation hearing in December 2006 the U.S. death toll in Iraq stood at 2,889; this month it reached 4,460.
In Afghanistan the U.S. death count more than tripled since gates took over, topping 1,500. Gates has signed a condolence letter to the family of every service member killed on his watch.
Gates spoke with greater bluntness about the costs of war as he approached the end of his tenure. At a Senate hearing Wednesday, he said that he measured the cost "in lives that are shattered, in bodies that are shattered, in minds that are shattered."
He finished that thought by adding that despite these costs, he and other leaders can't let them drive war strategy.
For his designated successor, CIA head Leon Panetta, Gates foresees a new set of challenges as the wars wind down.
In an Associated Press interview Monday, Gates said he worries that young officers and noncommissioned officers who have enjoyed an unusual degree of responsibility and room to innovate in Iraq and Afghanistan will come home from war to jobs in the Pentagon or at stateside bases and posts that are boring by comparison.
Panetta's Pentagon, he said, will have to find ways to avoid losing that talent and experience.
"Peace will bring its own challenges," he said.
Robert Burns can be reached at http://twitter.com/robertburnsAP