Besides the 30 civilians, two US service members were killed in the operation that targeted Taliban leaders planning additional attacks in Kunduz city.
"I deeply regret the loss of innocent lives, regardless of the circumstances," Gen. John W. Nicholson, commander of US forces in Afghanistan, said in a statement Saturday.
"The loss of innocent life is a tragedy and our thoughts are with the families. We will work with our Afghan partners to investigate and determine the facts and we will work with the government of Afghanistan to provide assistance."
Afghan forces, advised by the US military, conducted the operation Thursday in the village of Boz in Kunduz district, the statement said. It targeted Taliban leaders planning attacks in the city of Kunduz.
"During the course of the operation, friendly forces encountered significant enemy fire from multiple locations and defended themselves with ground fire and US air-to-ground engagements," the US military statement said.
"Initial reports indicate that several Taliban leaders and Taliban members were killed in the engagement."
Civilians, troops killed
At least 30 Afghan civilians were killed and 25 others injured in an air-and-ground operation launched in an area known as Bohd Qhandahari, said Sayed Mahmood Danish, a Kunduz provincial spokesman.
Four members of Afghan special forces were also killed and six others injured, Danish said. Twenty-six insurgents were killed and 10 others were wounded, he added.
The Pentagon identified the dead US service members as Capt. Andrew D. Byers, 30, of Rolesville, North Carolina, and Sgt. 1st Class Ryan A. Gloyer, 34, of Greenville, Pennsylvania. They were assigned to Company B, 2nd Battalion, 10th Special Forces Group (Airborne), Fort Carson, Colorado.
The troops came under fire during what the US military said this week was a mission to train, advise and assist its Afghan partners in clearing a Taliban position and disrupting the organization's operations in Kunduz district.
"On behalf of all of US 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," Nicholson said in a statement Thursday.
US Defense Secretary Ash Carter said he was saddened by the casualties.
"Our service members were doing their part to help the Afghans secure their own country while protecting our homeland from those who would do us harm," he said in a statement. "We will honor their sacrifice by finishing our important mission in Afghanistan."
The deaths occurred on the same day that a Taliban mortar attack killed at least seven people attending a wedding party in Faryab province in northern Afghanistan, provincial police spokesman Kareem Youresh said. At least 13 people were wounded.
In April, the Pentagon announced that 16 military personnel would be disciplined over a fatal US strike on a Kunduz hospital in October 2015. But the military maintained the strike was not a war crime because it resulted from unintentional human error and equipment failure.
The Pentagon said some personnel involved in the bombing of the Doctors Without Borders hospital "failed to comply with the rules of engagement and the law of armed conflict."