Afghan government forces regained control of a key district near the northern city of Kunduz on Tuesday, after Taliban fighters had threatened to capture a provincial capital for the first time since being driven from power in 2001.
Tuesday's victory came despite signs that the Islamist militant movement was stepping up its offensive in the broader war, six months after most foreign troops left the country.
A day earlier, a Taliban car bomber and six gunmen launched a spectacular attack on the Afghan parliament in Kabul. All of the assailants were killed. One civilian also died and at least 30 people were wounded.
The violence in Kabul, Kunduz province to the north and elsewhere has put Afghanistan's security forces under more pressure than at any time since most NATO combat troops withdrew, and there appears to be no easy way out of the crisis.
"The war continues to gain intensity," said Graeme Smith, a veteran Afghan analyst at International Crisis Group.
"Even more concerning, the nature of the attacks is becoming more serious: rather than pot-shots at convoys, we're now talking about battles that last for days."
On the front lines just outside Kunduz city in the north, Afghan army and police drove the Taliban back from Chardara district, which the insurgents had captured two days before, provincial police chief Abdul Saboor Nasrati said.
"New reinforcements arrived in Kunduz from northern provinces. They have inflicted heavy casualties on the insurgents and pushed them back from Chardara district," Nasrati said.
"We are pursuing them and the gun battle is still ongoing."
The brief capture of Chardara brought fighting to a bridge just 3 km (two miles) away from the Kunduz governor's compound, raising fears that the insurgents could overrun the city center.
That would mark the first provincial capital to fall to the Taliban since US-led military intervention toppled the hard-line Islamist regime, which had sheltered the Al-Qaeda architects of the September 11, 2001 attacks on American cities.
"The loss of a provincial capital would have profound effects, even if the city was overrun only for a matter of hours," Smith said.
Kunduz was also under heavy threat last summer and the city center held. In the traditional Taliban stronghold of Kandahar in the south, insurgents threatened the provincial capital a few years ago, but were beaten back.
US officials in Washington said it was unlikely Kunduz would fall into Taliban hands, and disputed the idea that recent attacks signified the insurgents were gaining ground against NATO-trained Afghan forces.
"Although the insurgents have executed a number of violent attacks since the announcement of the 2015 fighting season, including the attack on parliament, the (Afghan security forces) have demonstrated their growing capability to provide security," a State Department spokesman said.