When David Petraeus takes over as CIA director next week, he will confront a tricky problem: CIA analysts who will be working for him concluded in a recent assessment that the war in Afghanistan is heading toward a “stalemate” — a view with which Petraeus disagrees.

The analysts made their judgment in “District Assessment on Afghanistan,” completed in July, the same month Petraeus quit his post as U.S. commander there. He disagrees with the analysts’ pessimistic reading, as does Gen. John Allen, the new commander in Kabul; Gen. James Mattis, the Centcom commander; and Adm. Mike Mullen, the chairman of the Joint Chiefs of Staff.

The CIA assessment is “pretty harsh,” said a military official who is familiar with its contents. He noted that the document used the word “stalemate” several times to describe the standoff between NATO-led forces and Taliban insurgents. Even in areas where the United States has surged troops over the past 18 months to clear insurgents, the CIA analysts weren’t optimistic that the Taliban’s momentum had been reversed, as President Obama and his military commanders have argued.

“Everyone looking at Afghanistan today recognizes that the challenges are real and that progress isn’t easy,” said a civilian official familiar with the assessment, adding that it was coordinated carefully with the military. This is the CIA’s seventh such district-by-district examination of the country.

The analysts’ skepticism about U.S. strategy in Afghanistan, which has been deepening over the past several years, presents challenges for Petraeus and the White House.

The test for Petraeus will be whether he can give the analysts the independence they need to provide a sound evaluation of Afghanistan strategy, which he himself created. Petraeus has his own strong views about the war and has made clear that he will continue to say what he thinks. But if the analysts are taking a different view from the boss, there’s bound to be tension.

How Petraeus manages this inevitable friction — reassuring the analysts while remaining faithful to his own views — will be closely watched within and outside the CIA. This isn’t a military chain of command: Intelligence analysts resent efforts by outsiders (and even superiors) to shape their reporting. If they think Petraeus is trying to steer assessments, they’re sure to protest.

Petraeus maintained during his June 23 Senate confirmation hearing that he would give the analysts proper latitude in areas where he had been a commander, such as Iraq and Afghanistan. “In the Situation Room with the president, I will strive to represent the agency position,” he said, adding that he would be “keenly aware that I am the leader of an intelligence agency, and not a policymaker.”

Gossip about a supposed rift between Petraeus and the analysts has been circulating in Kabul during the past week, as word spread of the skeptical CIA assessment. Some speculated it was a preemptive strike by the agency bureaucracy; others saw it as a harbinger of impending change in White House policy. From my reporting, neither seems to be true. The analysts have long been skeptical on Afghanistan, but Obama has continued to support the military.

The larger challenge is for Obama. In 2009, he signed on to the limited objective of stopping al-Qaeda in Afghanistan and reversing the Taliban’s momentum — but using a broad counterinsurgency strategy to achieve that mission. If the CIA analysts’ view becomes widely shared, and there’s growing sentiment in Washington that the $100 billion-plus annual campaign is only buying an expensive stalemate, Obama will have to re-examine the plan and the troop levels. Ironically, if he chooses a more limited counterterrorism approach, Petraeus as CIA director would once again be at the center of the fight.

The White House for now seems comfortable with its gradual drawdown through 2014. The troubled relationship with President Hamid Karzai has improved slightly, thanks to a “reset” by the new U.S. ambassador, Ryan Crocker. There’s broad agreement, too, with the judgment of Obama’s sometime adviser, John Podesta, who argued after a July visit to Afghanistan for more emphasis on a political and economic transition strategy.

As with so many aspects of Afghanistan, there are echoes here of Vietnam — where CIA analysts were early and emphatic in their warnings that U.S. strategy wouldn’t succeed, but were countered by generals who insisted the United States could prevail with sufficient military power.

In a technical sense, Petraeus crossed the threshold between military and intelligence roles when he took off the uniform this week, but the real transition is ahead.