KABUL, Afghanistan — Taliban insurgents entered the southeastern Afghan city of Ghazni before dawn on Friday, and within hours they claimed to have much of the provincial capital under their control. If confirmed, the rout would be the insurgents’ most important strategic gain in years.
Witnesses and health officials feared the casualty toll would be high. Zahir Shah Nikmal, head of the provincial department of public health, said 16 bodies and 40 wounded people had been brought to hospitals so far. Almost all were members of the security forces, he said, and officials were trying to arrange evacuations by helicopter for the critically wounded.
Government officials denied the city had fallen, but they conceded that the insurgents were within 300 yards of the governor’s office and police headquarters.
“Fighting is ongoing but the whole city has not been taken by the Taliban,” Mohammad Arif Noori, the spokesman for Ghazni’s governor, said by telephone. “We will not allow them to take the city.”
It was the second determined assault on an Afghan city this year. In May, insurgents overran the western city of Farah, but they left a day later amid counterattacks from the Afghan government and American airstrikes.
The only other city to have fallen to the Taliban since they were driven from power in 2001 was Kunduz, in the far north, which the insurgents briefly occupied twice, in 2015 and 2016. Neither Farah nor Kunduz were as strategically important as Ghazni, the capital of Ghazni Province.
Zabihullah Mujahid, the Taliban spokesman, said on Twitter that the insurgents had infiltrated every part of the city. “Hundreds of Mujahedeen entered the city, captured the police headquarters and all six police districts and an important military base, Bala Hesar,” Mr. Mujahid said in an emailed statement.
“Attacks are underway on the governor’s office, the N.D.S. headquarters and other government offices,” he said, using the acronym for the National Directorate for Security, the Afghan intelligence agency.
Government officials denied a Taliban claim that the insurgents had shot down a helicopter. But they said both of the two helipads in the city were under attack and evacuation helicopters were struggling to land.
Residents reached by telephone in several neighborhoods said that heavy fighting was ongoing around them.
“Taliban are fighting with their whole power, they brought fighters from as many districts and provinces as they could,” said one resident, Nasir Ahmad Faqiri. “There are Taliban militants in all roads and streets of the city, but they are facing strong resistance from government forces.”
Ghazni, which the Afghan government says has a population of 280,000, sits on Highway 1, the important north-south route between Kabul, the capital, and Kandahar, the country’s second-largest city. Travelers in Kandahar on Friday reported being turned back because the insurgents had blocked the highway.
The American military said it had sent helicopters to support Afghan troops in Ghazni, and that it had carried out one airstrike, using a drone.
Afghan forces “held their ground and maintain control of all government centers,” said Lt. Col. Martin L. O’Donnell, a spokesman for the American military in Afghanistan. “This is yet another failed Taliban attempt to seize terrain, which will result in yet another eye-catching but strategically inconsequential headline.”
If the Taliban took Ghazni and held it, they would essentially have cut off the traditional Taliban homelands in the south from northern Afghanistan and the capital. Mr. Mujahid said the insurgents had closed Highway 1 to prevent reinforcements from reaching Ghazni.
Brig. Gen. Mohammad Radmanish, the spokesman for the Afghan Ministry of Defense, denied Ghazni was under any serious threat. “It is just propaganda by the Taliban. The whole city is under the control of Afghan forces,” he said. Six Afghan soldiers had been killed in the fighting, he said.
Reinforcements began arriving in the city, but the government was hampered in carrying out airstrikes because the insurgents were operating in civilian neighborhoods.
“Commando forces are responding to the Taliban attack but we are not carrying out airstrikes to prevent civilian casualties,” said Mr. Noori, the governor’s spokesman. He accused the Taliban of using the civilian population as human shields. Eight civilians had been wounded so far, he said.
Ghazni’s police chief, Col. Farid Ahmad Mashal, took to Facebook to say that the insurgents had been defeated, posing for photos with bodies of dead insurgent fighters in the streets.
“All areas are in our control,” Colonel Mashal said in a video, as gunshots were heard in the background. “Members of the Parliament, all the people have picked up arms with us.”
Many areas of Ghazni Province have been heavily contested by the insurgents in recent years, but this was the first serious attempt to take the provincial capital.
Arif Rahmani, a member of Parliament from Ghazni, said the government had not acted on months of repeated warnings that the Taliban were amassing around and inside the city. He said that while the police had shown brave resistance since the assault began, they were low on ammunition and food and were struggling with communications, with the Taliban having shut down phone networks.
“The reality is that 70 percent of the burden of the fighting in Ghazni is on the shoulders of the police, and their structure has long since fallen apart,” Mr. Rahmani said.
A New York Times reporter who visited Ghazni in May found residents complaining that many Taliban insurgents were already inside the city, and even collecting taxes from residents. Many expressed concern that the city would soon be attacked.
The Ghazni assault comes at a critical stage in the Afghan war, when President Ashraf Ghani and the Americans have been trying to persuade the Taliban to enter peace talks.
After a successful three-day cease-fire in June that was observed scrupulously by both sides, many Afghans had been hoping for another cease-fire during the Eid al-Adha holiday later this month. But Mr. Ghani was already facing political opposition to another such cease-fire, and the scenes from Ghazni were unlikely to help his cause.