KABUL, Afghanistan — The Taliban retreated from the capital of western Farah province Tuesday after launching a pre-dawn assault on the city that killed and wounded several Afghan troops, with U.S. airpower supporting government forces.

Afghan special operations forces, army and police, had started clearance operations on the city’s outskirts, U.S. and Afghan officials said. They were aided by Afghan Mi-17 helicopter gunships, which the Afghan Defense Ministry said had killed at least 10 fighters.

Some attackers were fleeing and others were hiding in civilian homes, the Defense Ministry said.

Army Lt. Col. Martin O’Donnell, a spokesman for the NATO mission in Kabul, said U.S. Air Force A-10 Thunderbolt II ground attack planes, which deployed to Kandahar Air Field in January, and MQ-9 Reaper drones were supporting Afghan ground forces and American and multinational advisers were assisting Afghan leaders directing the operation.

“We’re in a constant state of advising,” he said.

The militants had begun a multipronged assault into several areas of the city a few hours after midnight, Abdul Shakoor, a resident of the Bagh-e-Pul area, told Stars and Stripes earlier in the day by phone. His home is on the outskirts of the city of about 50,000.

“We are stuck at our homes, we cannot go out and everyone is in great fear,” Shakoor said. “I can see the Taliban from my house. They are roaming in the intersections.”

The Defense Ministry had quickly deployed reinforcements and vowed to repel the attack. Hours later, Shakoor said he could still hear gunfire as security forces fought back.

A lucrative drug route crosses the embattled province, connecting largely Taliban-held Helmand province to the south with Iran in the west.

Officials have warned of a deteriorating security situation for months, as insurgents have entered the capital on several occasions and threatened outlying districts.

The attack on Farah was the first on a provincial capital this year.

It’s unclear how far the militants advanced into the capital. On social media, the Taliban posted photos and videos purporting to show fighters taking government complexes or seizing military pickup trucks. They claimed to have overrun a police station and an intelligence outpost. Afghanistan’s Tolo News broadcast footage of a burning Humvee.

But O’Donnell said military surveillance feeds and Afghan reporting from the ground indicated the fighters hadn’t advanced beyond checkpoints on the city’s northern and western edges, and that the city itself remained under government control.

“At no time did the Taliban enter the city,” O’Donnell said. Though the insurgents have recently gotten “headline splashes” for taking remote district centers in some provinces, they’ve been unable to hold the terrain for long, he said.

Militants briefly took the capital of northern Kunduz province in late 2015 and threatened to take it again in 2016, but they have since failed to take a single capital — a fact frequently touted by U.S. and NATO officials, who say government forces are becoming more capable in battling the insurgents.

A resurgent Taliban, largely dependent on narcotics revenues, has expanded its sway in the country since the withdrawal of most international combat forces at the end of 2014. Meanwhile, the government has largely lost ground, and in just the past year security forces numbers fell to their lowest reported levels since early 2012.

The Kabul government and its international backers are seeking to reverse those trends by growing the country’s special operations command and air force.

The U.S. Army’s newly formed 1st Security Forces Assistance Brigade has been deployed to build up conventional forces at the tactical level, too, and more warplanes and drones have been sent to support ground operations.

The Trump administration’s strategy of renewed aggression here, meant to bolster the country’s security, has led to a dramatic hike in the number of airstrikes, many aimed at crippling the Taliban’s ability to profit from the drug trade.

So far, it seems to have done little to curb the Taliban advance, and despite the pressure the insurgents haven’t shown much interest in the government’s offer of a comprehensive peace agreement.

Since launching their spring offensive last month, they have reportedly carried out thousands of attacks throughout the country, including deadly suicide bombings in the country’s capital.

Kabul officials acknowledged to local media that security forces had suffered recent casualties in fighting to retake parts of Farah, Baghlan and Ghor provinces, though some defense officials disputed reports that military losses had reached 700 dead and wounded in recent weeks.

At least two Afghan security forces members had been killed in Tuesday’s fighting, said Ahmad Zaki, a doctor at the city’s central hospital. At least 16 wounded troops had been brought to the medical facility as of about midday. Five wounded civilians, including women, were also being treated.

Through a spokesman, the Taliban told the city’s residents earlier in the day to stay in their homes, promising they wouldn’t be harmed and that only military facilities were being targeted.

The Taliban have frequently claimed they seek to avoid civilian casualties, but human rights organizations have counted thousands of civilian deaths caused by insurgent violence in recent years — many the result of indiscriminate Taliban attacks in populated urban areas.

garland.chad@stripes.com

Twitter: @chadgarland