A raid by Kurdish and US commandos freed 69 detainees from an Islamic State prison in northern Iraq on Thursday, at the cost of one American soldier killed and four Kurds wounded.

The US commando is the first American soldier killed in action in Iraq since the withdrawal of Washington’s combat forces in 2011.

The raid was north of the town of Hawija at about 4 a.m. It was carried out after information that the detainees would soon be executed, according to the Pentagon. Five Islamic State fighters were detained and several killed, the Pentagon said, while Kurdish military sources said six were captured and 20 killed.

The Pentagon said more than 20 Iraqi troops and Kurds were among those freed, but the Kurdistan Region’s Security Council said no Kurds were freed.

A resident of the Hawija area said this week that ISIS had recently executed 11 young men who were the sons or relatives of police officers or other Iraqi forces. He said their bodies had been hanged on a nearby bridge.

American and Iraqi officials said US helicopters flew Kurdish and American Special Operations to the site, as American jets carried out airstrikes to cut off roads.