BAGRAM AIRFIELD, Afghanistan — The United States is bolstering its efforts to help the Afghan government squash a rash of deadly high-profile attacks in its capital city through Special Operations raids, intelligence to map out residents and additional military advising, the top U.S. general here said.

Army Gen. John W. Nicholson Jr. said that defending Kabul is the main goal for the U.S.-led military coalition right now. Although the number of bombings in the sprawling city has remained about the same, they have increased in size, he said. Hundreds of people have been killed in the past year’s blasts, terrorizing civilians and damaging embassies and other buildings.

“Yes, the Taliban is in the city,” Nicholson said. “Yes, there are facilitation networks in the city. These networks need to be identified and destroyed, and then the safe houses or whatever locations they have developed need to be identified and eliminated.”

The use of secretive U.S. Special Operations forces against networks of militants has been common from the streets of Baghdad to the mountains of eastern Afghanistan. But it rarely has been discussed in Kabul before. It comes as the U.S. and Afghan governments plan to increase the number of Afghan special forces from 19,022 to 33,896 by 2020, according to a Pentagon report to Congress released in December.

Nicholson spoke to reporters Wednesday at the main U.S. airfield north of Kabul as Defense Secretary Jim Mattis wrapped up a two-day visit to Afghanistan that included a visit with Special Operations troops based at Bagram.

The defense secretary, who did not speak on the record with reporters traveling with him Wednesday, flew to Bahrain afterward. Mattis is planning to meet with King Hamad bin Isa al-Khalifa and visit with U.S. troops.

Like Mattis, Nicholson sees an opening for the U.S. and Afghan governments to reach a peace deal with some members of the Taliban. He cited Afghan President Ashraf Ghani’s recent invitation to the Taliban to talk without preconditions, the Taliban not rejecting it out of hand and the ongoing U.S.-led military campaign among the factors that could force a negotiated settlement.

But the attacks in Kabul must be addressed, the general said. The city, once considered relatively safe compared with the countryside, has been the site of horrendous attacks over the past few years. U.S. military and intelligence officials have warned that the Taliban will continue to carry out high-profile attacks, an effort to show that the Afghan government does not have control.

Gen. John W. Nicholson Jr., the top American commander in Afghanistan, speaks to reporters on March 14 at Bagram Airfield north of Kabul. (Robert Burns/AP)

The attacks include a May 2017 bombing outside the German Embassy that killed at least 150 people and damaged several buildings. More recently, a Dec. 28 bombing of a Shiite cultural center by the Islamic State killed at least 50, and a Jan. 27 attack in which an ambulance packed with explosives killed at least 103 people near Kabul’s embassies.

The Taliban also launched coordinated attacks in January on the Intercontinental Hotel in downtown Kabul and in July on an Afghan military training academy. The hotel ambush left at least 42 people dead, and the academy attack killed 11. Ghani fired several senior Afghan security officials after the latter incident.

Security in Kabul has been complicated by the rapid and haphazard manner in which the city has grown in the past 15 years from about 500,000 residents to about 5 million, Nicholson said. Afghan civilians have increasingly moved there during 16-plus years of war seeking not only safety, but also jobs and modern amenities such as working cellphones and Internet service. The city’s square mileage is larger than that of New York City.

“There’s a lot of sprawl, and it’s easy to get in and out of the city,” Nicholson said. “These are neighborhoods that have grown up overnight.”

The Afghan government announced in August, before the most recent spate of violence, that it was developing a new plan to stop the attacks. Although officials have been secretive about it, it was believed to include building security in two rings — one at the edge of the city, and another inside wrapping around the sensitive area that is home to government institutions, embassies and the U.S. military headquarters.

Nicholson said the security at the outer ring has traditionally been porous, but dozens of Afghan police commanders have been fired in the past few months, potentially leaving room for improvement. Afghan soldiers now man the security checkpoints on the city’s perimeter, and an effort has been made to make sure they have appropriate training with explosives-sniffing dogs, X-ray machines and other equipment, the general said.

Additional U.S. military advisers, including some members of the U.S. Army’s new security force assistance brigade, also will be added to help build extra security in the city, said Nicholson and Army Col. Scott Jackson, the brigade’s commanding officer.

In between the two security rings, Afghan forces are expected to clear the area of militants with targeted, intelligence-driven raids as well as house-to-house clearing operations, Nicholson said. Elite U.S. Special Operations troops will participate in at least some of the raids. U.S. intelligence agencies will assist the Afghan government in better understanding the Kabul area, Nicholson said.

Nicholson also said that despite discussions about a settlement with the Taliban, it is not clear how long it could take to reach a deal. The strategy adopted by President Trump last year called for boosting the number of U.S. troops from about 11,000 to nearly 15,000 indefinitely while bolstering the air campaign against the Taliban and ratcheting up pressure on Pakistan to not harbor Taliban fighters.

In January, Trump suspended foreign aid to Pakistan, citing its past behavior. Asked Wednesday whether it has made improvements since then, Nicholson did not seem satisfied.