The Defense Department on Friday released the names of two soldiers killed in Afghanistan.

Capt. Andrew Byers and Sgt. 1st Class Ryan Gloyer died Thursday in Kunduz, Afghanistan, from wounds sustained while engaging enemy forces.

Both men were assigned to B Company, 2nd Battalion, 10th Special Forces Group, at Fort Carson, Colorado.

Byers and Gloyer were killed Thursday along with 26 civilians and three Afghan troops.

Four other American troops were wounded.

The soldiers came under fire during a "train, advise and assist mission" with Afghan troops, Defense Secretary Ash Carter said in a statement. The soldiers were working to clear a Taliban position and disrupt the group's operations in Kunduz district.

Byers, 30, was from Rolesville, North Carolina. He joined the Army in May 2008, arriving at Fort Carson in July 2014.

Byers, a Special Forces officer, had deployed once to Afghanistan, once to the Democratic Republic of Congo, and served in Italy.

His awards and decorations include the Bronze Star Medal, Purple Heart, three Army Commendation Medals, the Afghanistan Campaign Medal with Campaign Star, Iraq Campaign Medal with Campaign Star, the Combat Infantryman Badge, the Expert Infantryman Badge, the Parachutist and Military Free Fall Parachutists badges, the Ranger tab and Special Forces tab.

Gloyer, 34, was from Denton, Pennsylvania. He joined the Army in December 2004 and had served at Fort Carson since January 2015.

A Special Forces communications sergeant, Gloyer had deployed three times to Afghanistan and once to the Democratic Republic of Congo.

Gloyer's awards and decorations include the Bronze Star with V device, Bronze Star, Purple Heart, two Meritorious Service Medals, two Army Commendation Medals, the Afghanistan Campaign Medal with Campaign Star, the Combat Infantryman Badge, the Expert Infantryman Badge, the Parachutist Badge, the Ranger tab and the Special Forces tab.

Afghan officials said they were still investigating the attack and its civilian casualties, some of which may have been caused by airstrikes, the Associated Press reported. Residents later carried more than a dozen corpses of the dead, including children, toward the local governor's office in a show of rage a year after American forces attacked an area hospital, according to the AP.

Two senior Taliban commanders targeted in the raid were also killed, along with 63 other insurgents, Kunduz police chief Gen. Qasim Jangalbagh said, according to the AP. He said Afghan special forces carried out the raid and that he did not have any information about NATO involvement in the assault. The general identified the number of civilians killed, saying the count of 26 included members of the Taliban fighters' families. 

Brig. Gen. Charles Cleveland, briefing journalists in Brussels during a teleconference, said three Afghan troops were killed in the assault, the AP reported. Mohammad Radmanish, a deputy spokesman at the Afghan Defense Ministry, offered the same figure. 

In a later statement, Cleveland said that "friendly forces received direct fire and airstrikes were conducted to defend themselves" and an investigation was underway. He earlier described the assault as "not a common event," without elaborating. 

Fighting has been fierce in Kunduz province, as Taliban fighters briefly overran the city of Kunduz — the provincial capital with the same name — in early October, a show of strength by the insurgents that also highlighted the troubles facing Afghan forces 15 years into the war there, AP reported. The Taliban captured and held parts of Kunduz a year earlier as well before the city was liberated weeks later with the help of U.S. airstrikes, AP reported.