A US military investigation has found that air raids targeting the Taliban during a gun battle in northern Afghanistan last year killed 33 civilians.

Twenty-seven other civilians were wounded in the village of Boz in Kunduz city, a statement from US Forces Afghanistan said on Thursday.

The incident on November 3 saw US and Afghan troops carrying out a ground assault against the Taliban when they came under fire from the armed group, prompting a call for air reinforcements.

"Regardless of the circumstances, I deeply regret the loss of innocent lives," General John Nicholson, the top commander of US forces and the NATO mission, said.

According to the statement, the operation was launched to capture Taliban commanders the US said were behind the capture of parts of Kunduz in October 2015.

The civilian deaths caused an uproar and the United Nations and humanitarian organisations condemned the bombing raid.

"The loss of civilian life is unacceptable and undermines efforts towards building peace and stability in Afghanistan," Tadamichi Yamamoto, head of the UN Assistance Mission in Afghanistan, said in a statement after the raid.

Residents carried more than a dozen bodies, including children, towards a local governor's office in a show of anger.

OPINION: No consensus in Afghanistan on how to deal with the Taliban

The US statement said civilians were killed and wounded because the Taliban were using their houses as bases and, additionally, a Taliban weapons cache was hit "which also destroyed multiple civilian buildings and may also have killed civilians".

Speaking to Al Jazeera, residents of the village said the air raids hit civilian areas where many women and children were killed.

"We don't even know if the Taliban were actually killed in this attack. All we saw were dead bodies of the innocent people," Ruhani, a resident of Boz village, told Al Jazeera.

"We saw dead bodies of children as young as three years old. What was their fault?"

Another resident who lost members of his family in the fight said the attack "only killed innocent people" and the houses were targeted based on "speculation".

Charles H Cleveland, a spokesman for the US military in Afghanistan, told Al Jazeera that the raids killed at least 26 Taliban fighters including three "top leaders who led the capture of Kunduz".

"The only real option we had at that point was to conduct air strikes as the Taliban were attacking Afghan and US forces vigorously," he said.

"The village is not a normal village. There are a lot of Taliban fighters there. However, the only real solution to prevent civilian casualties is for the Taliban to not hide behind civilians," he said, adding that "even one civilian casualty is too many for us."

The carnage underscored worsening insecurity since the Taliban in October 2016 overran Kunduz city for the second time in a year, as NATO-backed Afghan forces struggled to rein in the fighters.

Civilians being killed by NATO has been one of the most divisive issues in its 15-year battle with the Taliban, prompting strong public and government criticism.