The Marine battalion fighting out of this southern Afghanistan district has suffered more losses than any other in the history of the decade-long Afghan war.

Defense Secretary Robert M. Gates visited Sangin on Tuesday to see what gains had come from the deaths of 29 Marines here over the past five months.

“Every day, I monitor how you are doing,” he told the Marines from the 3rd Battalion, 5th Regiment in Sangin. “And every day you return to your [base] without a loss, I say a little prayer. I say a prayer on the other days as well.”

The Pentagon chief was accompanied on the trip by Marine Lt. Gen. John F. Kelly, the father of 2nd Lt. Robert M. Kelly, 29, who was killed in Sangin in November while leading a platoon of Marines. The general met briefly and privately with Marines from his son’s platoon, who presented him with a picture of Robert, taken a few hours before he was killed and signed by all of the Marines in his unit. Kelly was recently nominated to be Gates’s senior military assistant.

The message Gates received from the Marines in Sangin, who since arriving in October have encountered nearly 1,000 bombs buried in roads and trails, was largely positive. About 1,000 Marines are in an infantry battalion.

Although Sangin remains one of the most violent districts in Afghanistan, attacks in the area have decreased sharply as Marines have fanned out into the lush green farmland that borders the river that runs through the district. Almost 90 percent of the unit’s deaths took place during the Marines’ first three months here, Gates said.

The narrative Gates encountered in Sangin — of heavy violence last summer and fall followed by a steeper-than-expected drop in attacks during the winter — largely matched the story he heard throughout the country during his two days of travel.

“The closer you get to this fight, the better it looks,” he said at his last stop, in Kandahar province’s Arghandab Valley.

But the defense secretary and other U.S. commanders cautioned that violence in Afghanistan typically drops during the winter and that it was too early to tell how much of a setback U.S. and Afghan forces had dealt the Taliban.

“The fight this spring and summer is going to be very tough,” Gates said. “The Taliban will try to take back much of what they have lost, and that in many respects will be the acid test.”

The level of violence this spring will help determine how many troops the United States pulls out in July, when the drawdown is expected to begin.

Sangin district is critical to the Taliban because its drug-processing labs and poppy crops, which are used to produce opium, account for about 50 percent of the Taliban’s drug profits, said Lt. Col. Jason Morris, who commands the 3rd Battalion, 5th Marine regiment in Sangin.

Morris echoed Gates in saying he expects that attacks in Sangin will surge this spring as mid-level Taliban leaders return from Pakistan and the foliage on the trees offers front-line fighters better cover from U.S. guns.

The Taliban, however, will be returning to a district with a much larger U.S. and Afghan military presence. In the past, largely undermanned British forces in the area had focused mostly on protecting their bases and ensuring that the main road through the district remained open. The Marines, bolstered by a larger Afghan army presence, said they have pushed off the main road into the farmland and villages that border the highway.

Even as they took heavy losses, the Marines killed hundreds of Taliban fighters, Morris said.

Despite those losses, the Taliban remains a lethal force in Sangin, so much so that the Afghan district governor’s office isn’t out in Sangin but rather behind the gates of the main U.S.-Afghan military base here.

But U.S. commanders are betting that it will be much harder for the Taliban to find sanctuaries this spring than in past years. After he met with Marines in Sangin, Gates visited with an Afghan police unit in Arghandab district, outside Kandahar city. The police are part of a relatively new initiative in which special operations forces train villagers to be police in more remote districts where the U.S. and Afghan governments cannot maintain a significant presence.

“The places the Taliban has traditionally used as support bases don’t look the same,” Lt. Gen. David M. Rodriguez, the second-highest-ranking U.S. commander in Afghanistan, told reporters. “We think they’ll be returning this spring to a significantly different environment than when they left last year.”