In an era in which Washington is increasingly disparaged, Defense Secretary Robert M. Gates is the ultimate Washington man.

It is manifest in his appearance: He favors dark suits, white shirts and neatly combed white hair.

His background: He’s spent four decades serving eight presidents.

And how he operates: He’s careful, conservative and consensus-oriented.

In his four years in the Pentagon, Gates has become an indispensable force in the debate over two deeply unpopular wars. He’s been a savvy manager of the Pentagon bureaucracy and earned a reputation as the most ruthlessly efficient defense secretary in decades.

“He’s an extremely effective bureaucratic operator, and I mean that in a good way,” said Eliot A. Cohen, a senior official in the George W. Bush administration and professor at Johns Hopkins University’s School of Advanced International Studies. “He’s straightforward, levelheaded and disciplined . . . a judicious guy at a time when we needed judicious.”

As Gates prepares to leave office this week, the criticism of him is that he has been more of an implementer of his bosses’ policies than a bold visionary intent on changing the military.

Gates bristled at the critique in a recent interview: “There hasn’t exactly been time to be a bold visionary in the middle of two wars.”

His legacy as defense secretary will probably be defined not by grand ideas but by his pragmatic stewardship of two wars and by how the longtime Washington insider wielded power.

Here are some lessons:

Lesson One: Buy time

Shortly after he took over as defense secretary in 2006, Gates told Gen. David H. Petraeus, then his Iraq commander, how he wanted to operate. “You have your battle space, and I have mine,” Gates said.

Petraeus’s fight centered on the insurgents and death squads roaming the streets of Baghdad. Gates’s fight was to buy more time in Washington for the president’s and Petraeus’s war strategy to show results.

His primary weapon was the Defense Department review. In January 2007, as the first 30,000 surge troops were heading toward Iraq, Gates scheduled a September review to evaluate whether the new war strategy and additional troops were producing tangible progress.

He employed the same tactic three years later in Afghanistan when President Obama dispatched 33,000 troops to Afghanistan.

The reviews helped the Bush and Obama administrations determine whether the military was making progress, and they helped to reassure Congress. “They give people a sense that we have actually got our hands on the steering wheel and are not just coasting,” Gates said.

The reviews served one other critical purpose: They put off critics agitating for immediate troop reductions and a major scaling back of U.S. goals. In short, they bought Gates’s commanders some precious time.

“I have consciously used them for that purpose,” Gates said.

Lesson Two: Let them see you cry

Gates had a hard-earned reputation for toughness, having fired or replaced at least seven top officials during his tenure. But he also was not afraid to show a softer side.

In the middle of the bloodiest stretch for U.S. troops in Iraq, Gates delivered a speech to the Marine Corps Association. The setting was a bland Crystal City ballroom.

Gates told the story of Marine Capt. Douglas Zembiec, who had led his men through hard fighting in a 2004 battle in Fallujah. After the tour, Zembiec returned to a Pentagon desk job but chafed at the assignment. He volunteered to go back to Iraq in early 2007.

“This time, he would not return — to his country or to his wife, Pamela, and his 1-year-old daughter,” said Gates, fighting back tears. He gripped the lectern with his right hand. His voice was so full with emotion that he barely made it through the final two minutes of his speech.

In the years that followed, Gates backed up the emotion with action, speeding new mine-resistant vehicles to the battlefield and adding helicopters and medical facilities to ensure that wounded troops in remote areas of Afghanistan reached a field hospital in less than an hour after injury. The moves, which Gates describes as his proudest legacy, saved thousands of American lives.

Troops who were risking their lives in Afghanistan and Iraq, meanwhile, found solace in Gates’s outward displays of emotion. “He captured the hearts of a lot of mid-grade officers. This is a guy they trusted and believed in,” said Jim Thomas, a Pentagon official in the George W. Bush administration and the director of studies at the Center for Strategic and Budgetary Assessments in Washington.

As time passed and the deaths mounted, Gates felt the burden of the losses more acutely and choked up with greater frequency, particularly during visits to battlefields. In the final weeks of his Pentagon tour, he worried in interviews that his attachment to the troops was making him too cautious.

In December, Gates helicoptered into a hardscrabble U.S. base near the Pakistan border. Many of the soldiers had just been through a withering, week-long battle that took the lives of six of their colleagues.

“I feel a personal responsibility for each and every one of you since I sent you here,” Gates told them. “I just want to tell you how much I love you.”

Lesson Three: Keep some thoughts to yourself

Asked during his 2006 confirmation hearing whether the United States was winning in Iraq, Gates responded with two words. “No, sir,” he said.

The simple response earned him a reputation for straight talk.

But on the most contentious issues facing the Obama administration, Gates was often exceptionally opaque. Take the wrenching 2009 debate over the troop surge in Afghanistan. In the months leading up to the surge, Gates warned that he would be “deeply skeptical” of any request from Afghanistan for additional U.S. forces. He spoke eloquently about the limits of American power to remake the world and the strain the wars were imposing on America’s “exhausted” military.

But Gates also believed that Petraeus’s troop-intensive tactics in Iraq had helped turn around that war, and he had argued that losing in Afghanistan would be “disastrous.”

In other words, advocates as well as opponents of the military’s request for 40,000 more troops could find reasons to believe that Gates sympathized with their position.

“He listens more than he talks,” Secretary of State Hillary Rodham Clinton told Time magazine. “He is very careful about when he intervenes and what he says because he knows his words carry a lot of weight.”

Ultimately, President Obama decided to send 33,000 troops to Afghanistan and bring them home in July 2011. The compromise was known as the “Gates option.” Last week, as Gates prepared to leave the Pentagon, Obama promised that the last of those troops would be home by September 2012.

Lesson Four: Accept the limits of your power

In his first major address to the Army, Gates talked expansively about the importance of training foreign forces in places such as Afghanistan.

The Army, which prefers to focus on fighting, has always treated the advisory mission as a backwater, and Gates worried that it would get abandoned as soon as the current wars were over.

“How the Army should be organized and prepared for this advisory role remains an open question and will require innovative and forward thinking,” he said.

Four years later, Gates raised exactly the same question in a speech at the U.S. Military Academy at West Point.

Gates could have ordered the Army to fix the problem by creating a special advisory career field as some defense policy analysts advocated. But he decided that any solution he imposed on the Army would not have lasted beyond his tenure.

“My experience has been over the years that if you try to impose change on an organization, you will fail,” he said.

Gates continued to raise the issue in speeches. The Army has formed advise and assist brigades to work with the Iraqi and Afghan militaries. But Gates said the service still has much work to do to ensure that its experience working with the Iraqi and Afghan armies is not forgotten.

Lesson Five: Don’t forget the alumni

Before he ran the Pentagon, Gates was the director of the CIA and the president of Texas A&M. “One of the things that the CIA, Texas A&M and the Defense Department all have in common is alumni,” he said in a recent interview. “And they all feel like they should have a vote in how things should get done.”

In May 2010, Gates had become worried that the Navy was not thinking hard enough about the threat posed by China, which was working furiously to develop missiles that could sink aircraft carriers.

Although he had discussed the issue with the Navy’s top admirals, the conversations were not enough to spark fresh thinking or debate. So Gates raised the subject in a deliberately provocative speech to the U.S. Navy League, an advocacy group run by retired admirals.

“Do we really need 11 carrier strike groups for another 30 years when no other country has more than one?” he asked. He was effectively firing a salvo at the Navy’s signature ship in front of the service’s staunchest alumni boosters.

A few days after his speech Gates conceded that he had no interest in cutting the Navy’s carrier fleet. “I am not crazy,” he told reporters. The goal was to spark a debate about the future, he said.

During his last days in the Pentagon, Gates has worried that the looming budget crisis will cause the U.S. military to pull back from the rest of the world. “What are the consequences of U.S. disengagement?” he asked. “What does that mean in terms of our national interests? I think people haven’t really engaged that debate.”

With Pentagon budgets set to shrink by about $400 billion over the next 12 years, many of the hardest decisions about the military’s future will be left to Leon Panetta, Gates’s successor.