Jane Onyanga-Omara

USA TODAY

Two American service members were killed and four others wounded after they came under fire in northern Afghanistan on Thursday, U.S. military officials said.

They were on a mission with the Afghan military to clear a Taliban position and disrupt the group’s operations in the Kunduz district when the incident happened.

The joint raid that involved NATO airstrikes also killed 26 civilians and three Afghan troops, and investigators were working to determine what went wrong, the Associated Press reported.

NATO's Resolute Support mission tweeted the strikes were carried out "to defend friendly forces under fire" and that reports of civilian casualties would be investigated.

The dead U.S. service members' names won't be released until after their families are informed.

"On behalf of all of U.S. Forces – Afghanistan, today’s loss is heartbreaking and we offer our deepest condolences to the families and friends of our service members who lost their lives today," Gen. John W. Nicholson, the commander of U.S. Forces in Afghanistan, said in a statement.

"Despite today’s tragic event, we are steadfast in our commitment to help our Afghan partners defend their nation,” he added.

The situation in Kunduz has remained tense since the region was briefly captured by the Taliban late last year. It was attacked again by Taliban fighters in October.

The target of the raid were two senior Taliban commanders, who were killed in the fighting along with 63 other insurgents, Kunduz police chief Gen. Qasim Jangalbagh said, the AP reported. He said Afghan special forces carried out the raid, and he did not have any information about NATO involvement.

Jangalbagh said 26 civilians, including members of the Taliban fighters’ families, were killed.

President Obama has said around 8,400 troops will remain in Afghanistan through the end of his presidency to train and advise Afghan forces, and support operations against terrorists.