ARGHANDAB, Afghanistan — Afghan and NATO forces cleared Taliban guerrillas from a cluster of villages outside Kandahar on Thursday, removing for the moment any threat that they might try to move into their former stronghold in the southern part of the country.

The Taliban fighters, who had infiltrated as many as 18 villages here, largely retreated before a force of about 1,100 Afghan soldiers that began moving into the area on Wednesday, Afghan and NATO officials said. NATO planes and helicopters supported their advance.

Afghan and NATO officials took slightly different views of the operation, with the Afghans trumpeting it as a great success. Afghan soldiers killed 56 Taliban fighters during the operation, including a number of foreigners, Gen. Zahir Azimi, the spokesman for the Afghan Ministry of Defense, said at a news conference. The operation involved no loss of civilian life, and the Afghan army suffered no casualties beyond two reported on Wednesday.

NATO officers offered a more measured view: They said fighting had been minimal with the Taliban, who they said had not been so numerous to begin with. Still, no one disagreed that, for the moment, the Taliban had been dispersed from the edges of one of the country's most important cities.

"Arghandab is totally cleared out of the enemies," Azimi said at his news conference, in Kandahar. He conceded, however, that a number of Taliban fighters appeared to have slipped away.

By Thursday evening, NATOs force in Afghanistan, the International Security Assistance Force, was urging the roughly 4,000 Afghans who had fled their homes to return.

The quick response of the Afghan army, and the apparent success of the operation, represented a bit of good news here after a run of gloomy events.

Last week, Taliban fighters mounted a brazen assault on the main prison in Kandahar, blowing up the mud walls, killing 15 guards and freeing about 1,200 inmates, including several hundred Taliban fighters. Then came the reports that Taliban fighters — numbering 400 in some reports — were infiltrating the villages around Arghandab, a river valley about 10 miles northwest of the city that is critical to its defense.

The events around Arghandab have unfolded amid a growing recognition that the sanctuaries enjoyed by the Taliban across the border in nearby Pakistan are posing a serious threat to the NATO-backed Afghan government. This week, President Hamid Karzai threatened to send troops across the border into Pakistan if Islamabad continued to allow the sanctuaries to flourish.