KABUL, Afghanistan -- A U.S. airstrike that likely killed 26 civilians this week was intended to help Afghan forces who were battling insurgents in the north of the country, U.S. and Afghan officials said Saturday.

The strike was called in after two U.S. and three Afghan troops were killed in a fierce battle in Kunduz province.

The U.S. military spokesman in Afghanistan, Brig. Gen. Charles Cleveland, said the strike was “an effort to defend troops.”

Get Breaking News Delivered to Your Inbox

“Every indication that we have right now is that the Taliban were firing on these friendly forces and every part of this was to defend those friendly forces and ... protect the people of Kunduz,” he told reporters.

Gen. John Nicholson, commander of U.S. forces in Afghanistan, said he “deeply” regretted the loss of innocent lives.

“The loss of innocent life is a tragedy and our thoughts are with the families,” Nicholson said in a statement.

Afghan Defense Ministry spokesman Dawlat Waziri said insurgents had been gathering in the area ahead of a planned attack on Kunduz city. Afghan troops had called in the air support, which he said had also killed at least 30 Taliban fighters. Gen. Qasim Jangalbagh, the provincial police chief, said the 26 civilians who were killed included members of insurgents’ families.

The Taliban have launched repeated assaults on the provincial capital, also called Kunduz. They briefly overran the city last September, holding it for three days before a three-week counterattack drove them out.

Meanwhile, a bomb targeting a district leader in eastern Afghanistan killed his driver and wounded the official and another person on Saturday, while a similar attack on a police vehicle in the capital, Kabul, wounded four people.

The sticky bomb in the eastern Bati Kot district was attached to the vehicle of district chief Ghalib Mujahid, according to Attaullah Khogyani, spokesman for the governor of Nangarhar province. The Kabul bombing was confirmed by the office of the city’s police chief.

No one claimed the attacks, but the Taliban frequently target government officials and security forces.