The assault came as a surprise to no one. American commanders and Afghan officials have said publicly for weeks that an invasion of Marja was imminent, in an effort to chase away as many Taliban fighters as possible and keep the fighting, and civilian casualties, to a minimum. The hope is to win the support of local residents, even at the expense of letting Taliban get away.

Indeed, the American and Afghan troops moving into the city are setting for themselves a very high  and possibly difficultstandard. They have urged the Afghans to stay in their homes rather than flee the city. But that could make it difficult to avoid killing at least some noncombatants.

“The message for the Taliban is: It will be easy, or it will be hard, but we are coming,” Brig. Gen. Larry Nicholson, the commander of the United States Marines in Helmand Province, told the men of Company K before the operation began. “At the end of the day, the Afghan flag will be over Marja.”

The American and Afghan strategy of broadcasting their intentions seems to have worked so far. Hundreds of Taliban fighters are believed to have the fled Marja in recent weeks, including many commanders  a sign that the Taliban’s leaders, who are believed to be based in the sprawling Pakistani city of Quetta  have decided that Marja will be lost. “We know a bunch of them left,” a senior NATO commander said, speaking on the condition of anonymity because of the delicacy of the operation.

Last week, Afghan intelligence agents captured the Taliban’s “shadow governor” after he had fled Marja on the orders of his commanders in Pakistan, NATO officials said. The governor, whose name was not disclosed, was spotted by Afghan officials as he drove through Kandahar, probably on his way out of the country, officials said.

The capture of the local Taliban chief is the latest in a number of “shadow governors” who have been killed or captured in recent weeks by Afghan or American forces. Despite their titles, the Taliban “governors” often serve as the overall military commanders in an area, as well as taking charge of some civilian duties.