The Taliban have launched a new large-scale attack on one of Afghanistan’s main cities, Kunduz, and taken hospital patients as hostages, the government said Saturday, even as the insurgent group continued negotiations with the United States on ending America’s longest war.

The militants, who have demanded that all foreign forces leave Afghanistan, now control or hold sway over roughly half of the country and are at their strongest since their 2001 defeat by a U.S.-led invasion. Such attacks are seen as strengthening their negotiating position.

Presidential spokesman Sediq Seddiqi said Afghan security forces were repelling the attack in parts of Kunduz, a strategic crossroads with easy access to much of northern Afghanistan as well as the capital, Kabul, 335 kilometers (about 200 miles) away.

Seddiqi told reporters that the assault was “completely against the peace talks” and asserted that the militants were sheltering among civilians.

The Taliban were in control of the hospital in Kunduz and both sides in the fighting had casualties, provincial council member Ghulam Rabani Rabani told The Associated Press. He could not give an exact number.

An Afghan security forces member stands guard during a fight against Taliban insurgents in Kunduz province, north of Kabul, Afghanistan, Aug. 31, 2019.

The militants had taken hospital patients as hostages, defense ministry spokesman Rohullah Ahmadzai told reporters. He did not say how many.

“We could very easily attack but we don’t want civilian casualties,” he said. Hospital officials could not immediately be reached.

Ahmadzai asserted that 26 Taliban fighters had been killed in an airstrike but did not mention any casualties among civilians or Afghan security forces.

The Taliban launched the “massive attack” from several different points around the city overnight, said Sayed Sarwar Hussaini, spokesman for the provincial police chief.

“I can confirm that intense gun battles are going on around the city, but the Taliban have not been able to overrun any security checkpoint,” he said. Reinforcements had arrived and Afghan air forces were supporting ground forces, Hussaini said.

Officials with the NATO mission in Afghanistan did not immediately respond to a question about whether its forces were responding to the attack.

The Taliban have continued bloody assaults on civilians and security forces even as their leaders meet with U.S. peace envoy Zalmay Khalilzad in Qatar to negotiate an end to nearly 18 years of war.

Talks continued on Saturday, the Taliban spokesman said. Both sides in recent days have signaled they are close to a deal. The Afghan presidential spokesman said Khalilzad will visit Kabul at some point to brief the government on the details.

FILE – U.S. Special Representative for Afghanistan Reconciliation Zalmay Khalilzad attends Afghan peace talks in the Qatari capital, Doha, July 8, 2019.

One Afghan analyst, former deputy interior minister Mirza Mohammad Yarmand, said the attack on Kunduz showed the Taliban are not interested in a cease-fire, which has been a key issue in the Qatar talks.

The United States in the negotiations has also sought Taliban guarantees that Afghanistan will no longer be a launching pad for terror attacks such as the Sept. 11, 2001, attack on the U.S. by al-Qaida. The Taliban government had harbored al-Qaida leader Osama bin Laden.

Some 20,000 U.S. and NATO forces remain in Afghanistan after formally ending their combat role in 2014. They continue to train and support Afghan forces fighting the Taliban and a local affiliate of the Islamic State group.

Many Afghans worry that an abrupt departure of foreign troops will leave Afghan forces vulnerable and further embolden the Taliban, who already portray a U.S. withdrawal as their victory.

“We have lost the city in the past and know the Taliban can attack again from insecure areas,” a lawmaker from Kunduz, Fatima Azizi, told the local Ariana television channel on Saturday.

“Unfortunately, civilians are again the victims,” she said.

The Taliban seized Kunduz, at the heart of a major agricultural region near Tajikistan, for around two weeks in 2015 before withdrawing in the face of a NATO-backed Afghan offensive. The insurgents pushed into the city center a year later, briefly raising their flag before gradually being driven out again.