Gen. John Campbell answers a question during a Senate Armed Services Committee hearing on Capitol Hill in Washington, on Tuesday, Oct. 6, 2015. Campbell testified that the Afghan military doesn't have "the necessary combat power and numbers to protect every part of the country."

WASHINGTON — The U.S. commander in Afghanistan said Tuesday he has recommended the White House delay the withdrawal of US troops planned for next year because Afghan forces lack the capability to defend the country.

Gen. John Campbell told the Senate Armed Services Committee that the U.S. and Afghan security forces were surprised last week by the Taliban seizure of Kunduz, and the ability of local forces to repel such attacks remains “uneven and inconsistent.”

The general has given President Barack Obama troop-strength recommendations for the coming years as the president reviews plans to draw down to just an embassy force, beginning in January. Campbell said his recommendations will include keeping more troops to gird security, though he declined to share details publicly during the testimony.

“The Afghans and quite frankly the coalition were surprised when the Taliban was able to take over Kunduz city,” he said.

The Taliban under a new commander seized the provincial capital last week as part of its largest offensive in years that involved thousands of fighters and focused on taking other key hubs in northern Afghanistan.

Campbell said the fighting in Kunduz underscores several shortcomings in the Afghan security forces.

“They do not possess the necessary combat power and numbers to protect every part of the country,” he said in written testimony to the Senate committee.

The U.S. military is backing the Afghan army as it attempts to retake the city, though one of its airstrikes destroyed a key hospital, complicating the battle and triggering an investigation.

Campbell said the U.S. strike that killed 22 civilians and damaged a hospital run by the French aid agency Doctors Without Borders was a mistake. He guaranteed a thorough and transparent investigation and ordered in-depth training of the entire force on the rules of engagement.

“We would never intentionally target a protected medical facility,” he said.

Afghan forces requested close air support, Campbell said, reversing initial reports that U.S. special operations forces were under attack. He also said it was a U.S. decision within the U.S. chain of command to conduct the airstrike.

Defense Secretary Ash Carter said Tuesday the military “deeply regrets the loss of innocent lives” during the strike, which the military said was carried out by an AC-130 gunship. He said the U.S. is investigating and supporting concurrent investigations by NATO and the Afghan government.

“The U.S. military takes the greatest care in our operations to prevent the loss of innocent life, and when we make mistakes, we own up to them,” Carter said in a released statement. “That's exactly what we're doing right now.”

Campbell told the Senate that the U.S. drawdown has contributed to the situation.

“Our force reduction, drop in enablers, and resultant [close-air-support] gap have created challenges for the [Afghan security forces]. They have understandably struggled at times to adjust,” he said in the written testimony.

The White House is now deciding how many troops to keep in Afghanistan next year.

Obama agreed to slow his withdrawal plans earlier this year after a meeting in Washington with Afghanistan President Ashraf Ghani by keeping 9,800 troops there, instead of reducing the number to 5,000. But the president has said he still plans to bring the war to an end by the end of his second term.

Sen. John McCain, R-Ariz., said the situation in Afghanistan and the condition of its security forces are similar to the situation in Iraq, as the United States pulled all its forces from that country in 2011, following an eight-year ground war.

“The shortfalls are hauntingly familiar — intelligence, logistics, air lift and close air support, special forces, and institutional development,” McCain said. “And yet, the White House remains committed to its politically driven withdrawal of nearly all U.S. forces from Afghanistan.”

McCain and other Republicans have hammered Obama for his decision to pull out of Iraq, a move that eventually led to an Islamic State invasion there and in Syria.

That conflict has drawn the United States into a protracted air campaign with about 3,000 troops, including trainers and advisers, that the Obama administration and military brass has said will likely last for years.