No U.S. general has spent more time in Afghanistan than Lt. Gen. David M. Rodriguez.

He is the primary author of the U.S.-Afghan war plan, a 600-plus-page classified document that is a catalogue of the lessons he has taken from three years of fighting the war. He can rattle off from memory the number of Afghan bureaucrats manning a lonely outpost in Zhari district. “Four months ago, we had one district governor and a bad police chief,” he said. “Now there are 13 people and a good police chief.”

Gen. Stanley A. McChrystal, the former top commander in Afghanistan, calls him the “best combat leader I have ever known.”

But Rodriguez will not be leading the war in Afghanistan anytime soon. This summer he will be returning home to the United States to take over U.S. Army Forces Command, a four-star job in the Army’s vast stateside bureaucracy. The decision to bypass Rodriguez for the top job reflects a determination among senior Pentagon officials that the war needs a commander who can make the case for the increasingly unpopular conflict to Congress, the news media and skeptics in the White House.

In Washington, Rodriguez is seen as a savvy fighter but a so-so salesman.

A Pentagon spokesman said no final decisions have been made about a replacement for Gen. David H. Petraeus, who has told the Pentagon that he will serve through the fall. The front-runner is Lt. Gen. John Allen, who played a key role in turning the Sunni tribes against the Iraqi insurgency but has never served in Afghanistan.

Rodriguez, friends said, is disappointed by the decision to bring him home. He will leave Afghanistan with the war still very much in doubt. He will also take with him a depth of experience in Afghanistan that few generals can match.

“Rod is the person who understands the Afghan power dynamic better than just about any other senior official,” said Sarah Chayes, a civilian adviser to the U.S. military who has been a critic of U.S. policy. “He truly grasps the role of abuse of power, corruption and humiliation in driving the conflict. The flair he has for Afghanistan is incredibly rare.”

Rodriguez stands 6 foot 4 inches and typically wears a rumpled, slightly baggy uniform. In meetings with his staff, he listens more than he lectures, often playing with a pair of smudged, bent reading glasses.

When Rodriguez first arrived in Afghanistan in 2007, he was shocked at how little the U.S. military knew about the country. “I always felt uncomfortable that we didn’t know enough because the focus of the nation had been on Iraq,” he said. “It took us almost six months to figure out what we were doing, which is way too long.”

After years of relative dormancy, the Taliban had reemerged as an enemy that was every bit as lethal to U.S. troops as the Iraqi insurgency. For the relatively small force of about 25,000 service members in Afghanistan, it was an intense period.

On April 12, 2007, Rodriguez was visiting a company based at a remote outpost in Ghazni province when a U.S. patrol, racing to help another unit, struck a massive roadside bomb.

Rodriguez, who had already led troops in two tours of Iraq, ordered his Blackhawk helicopter to land and pick up a badly wounded soldier. It is rare for a general’s helicopter to touch down in the middle of firefight. It is even more unusual for a general to attempt lifesaving aid.

Rodriguez hunched over Sgt. David A. Stephens, a 28-year-old father of two, and tried to stem the bleeding from his legs, according to a soldier on the helicopter. “Stay with us,” the general yelled over the rotors’ thump. Stephens’s battalion commander performed mouth-to-mouth resuscitation on the soldier. He died on the helicopter.

When Rodriguez’s first tour ended in spring 2008, he was convinced that his troops’ work with the Afghan army and government officials had hurt the Taliban. An internal unit history from 2008 captures his optimism.

“The people began seeing a government responsive to their needs,” the history said. “Through polling we saw increased confidence in the government. In fact, we’ve seen numerous incidents of villages expelling insurgents and outright defying armed insurgent demands.”

Rodriguez took a job in the Pentagon as the senior military assistant to Defense Secretary Robert M. Gates. As the months passed, the violence in Afghanistan grew. The Taliban had been able to intimidate the locals and exploit frustration with the Afghan government in ways Rodriguez had not seen or understood.

“It was really below the surface and insidious,” he said. “We fought hard every day to understand how Afghanistan worked. But we had a very shallow knowledge.”

In June 2009, Gates tapped McChrystal, who had spent most of his career in the secretive Joint Special Operations Command, to fix the foundering war effort. Gates selected Rodriguez to build a new command that would manage and plan U.S. and NATO military operations in Afghanistan.

McChrystal and Rodriguez were West Point classmates and had been close friends since the mid-1980s. McChrystal initially focused on building a relationship with the mercurial Afghan president, Hamid Karzai. Rodriguez set to work on the war plan.

With the help of representatives from a half-dozen Afghan ministries, he identified about 90 key districts out of more than 400 that the Afghan government had to bring under control. Most were on major commerce routes or connected key agricultural areas to major markets.

He assigned U.S. officers to work full time at ministries, like education, finance and rural development, that he believed were critical to building effective district-level government. “The State Department absolutely hated it, because they saw it as militarizing civilian agencies,” said Alissa Stack, who worked as a civilian employee for the Defense Department in Kabul and who led the effort for Rodriguez. “But no one had ever explained the international military strategy to these ministries. They couldn’t help us if they didn’t understand what we were trying to do.”

Last June, McChrystal resignedafter officers on his staff made disparaging comments about Obama administration officials. He was replaced by Petraeus, who has pressed U.S. forces to step up attacks on mid-level Taliban leadership but left the rest of the Rodriguez war plan in place.

The two officers are strikingly different. Petraeus has carefully honed a reputation over the past 20 years as one of the Army’s warrior-scholars. He finished in the top 5 percent of his West Point class, earned a doctorate from Princeton University and led a high-profile group of historians and military officers in drafting a new counterinsurgency doctrine for the Army.

Rodriguez finished 13th from the bottom of his West Point class, an early failing that he still carries with him, according to friends. He has a disarmingly goofy sense of humor that he uses to get over the language barrier with Afghans.

At a base south of Kabul recently, an Afghan army camerman tried to jog past Rodriguez so that he could get a shot of the general walking toward him. Rodriguez began running to keep pace. In a matter of seconds he had baited the camerman into an all-out, arms-pumping footrace to the cheering delight of the Afghan soldiers on the base.

“Rod is very charismatic,” a fellow officer said. “He just can’t bring himself to translate that into a public persona.”

In the past year, Rodriguez has worked on the way he communicates. He stopped swearing after an aide calculated that he dropped 92 expletives in the course of a two-hour meeting with his staff.

Last month Rodriguez met with a group of about a dozen prominent U.S. businessmen who were visiting Kabul as part of a battlefield tour. As he answered their questions, Rodriguez glanced down at an index card with key points he wanted to make. The card also included a couple of personal messages.

One was the abbreviation “SDD,” which stands for “slow down, dummy.” It was a reminder to take his time explaining himself. “Show some emotion!” a second prompt urged.

In the past few months, there have been indications of the success of Rodriguez’s approach. Violence in key districts where the U.S. and Afghan governments have concentrated forces is significantly down. Local government is taking root.

The unanswered question is whether the gains will prove durable. Many of the power brokers and warlords, whose corrupt practices fueled the Taliban’s reemergence, still retain their influence.

Last fall Rodriguez was touring a major U.S. base in southern Afghanistan when he learned that the U.S. commander in the area had paid $20 million to a construction firm linked to a corrupt regional power broker. He quickly issued an order asking his five regional commanders to look into buying rock crushers and hire Afghans for $6 or $7 a day to make their own gravel.

Six months later, the order appears to have been lost in the bureaucracy. Some officials blame the flurry of orders put out by Rodriguez’s command for the inaction.

The other big worry is the Taliban’s sanctuary in Pakistan. In his recent meeting with the business leaders, Rodriguez sketched out the magnitude of the problem: There are at least three plants in Pakistan that manufacture ammonium nitrate used in bombs in Afghanistan.

“Why don’t you buy the ammonium nitrate plants?” one member of the group asked.

“Why wouldn’t you just bomb them?” another pressed.

Rodriguez replied that the only defense was to work harder to build the Afghan government and military. “If Pakistan gets worse, we have to make it stronger over here, and then you are in a battle for time,” he said.

These days Rodriguez and his staff spend hours debating the best ways to measure progress in the areas where they have concentrated forces. For months they did it by making the regional commands answer 130 questions on each of the 90-plus key districts. Recently Rodriguez has pressed his staff to pare back the queries. “We’ve been too overbearing,” he said.

The problem is that U.S. commanders are trying to measure how Afghans feel about the Taliban and their government. “It is all about their head and heart,” Rodriguez said. “And you just can’t measure head and heart.”

In December, Gates told Rodriguez that he was considering promoting him to four-star rank and moving him to South Korea. For the first time in his career, Rodriguez resisted a new assignment. Some of it was personal. His wife, who he had barely seen over the past four years, didn’t want move to Korea.

Rodriguez also knew that the Korea job, which typically lasts three years, would make it impossible for him to return to Afghanistan. This summer Rodriguez will take over U.S. Army Forces Command.

In pressing not to go to Korea, he argued that the Afghan war might prove tougher than expected, several senior defense officials said. The Pentagon might need his experience.