Kurdish and US forces stormed an Islamic State prison in northern Iraq, freeing some 70 captives who were facing imminent execution, the Pentagon said.
A US serviceman died of wounds sustained in the pre-dawn operation, the first to be killed in action since the US-led campaign against IS began in Iraq in June 2014.
Five IS militants were captured and several others killed in the raid on a compound near Hawijah, Pentagon press secretary Peter Cook said.
"This operation was deliberately planned and launched after receiving information that the hostages faced imminent mass execution," Cook said in a statement.
The Hawijah raid marked an apparent break with the normal modus operandi of US forces, which are in Iraq to support government forces but do not directly engage in combat in line with President Barack Obama's "no boots on the ground" policy.
Cook pushed back against the suggestion that this signalled an expansion of the US role in Iraq.
"This is a unique situation," he said, adding that the mission was given the green light by Defense Secretary Ashton Carter, and that the White House was notified.
"We were asked for assistance" by the Kurdish government, Cook said, stressing that "the United States are not in an active combat mission in Iraq."
Residents told AFP that several Chinook helicopters were involved in the raid and that several IS-run checkpoints in the area were targeted by air strikes.
Cook said US helicopters and special operations forces accompanied Kurdish peshmerga forces to the prison compound. The American who later died was wounded "acting in support of Iraqi peshmerga forces after they came under fire from ISIL," he said.
The mission was "authorized consistent with our counter-ISIL effort to train, advise, and assist Iraqi forces," using an alternate acronym for Islamic State, the militant group that has sought to carve an Islamic caliphate out of large parts of Iraq and Syria.
"Approximately 70 hostages were rescued including more than 20 members of the Iraqi security forces," Cook said, adding that the operation had also produced "important intelligence about ISIL."
According to the office of Kurdish intelligence chief Masrour Barzani, 69 prisoners were rescued, six IS fighters detained and more than 20 killed.
Cook also said that the slain US commando was the first US combat death since 2011.
- 'Tough fight' -
Signup to our newsletter and follow us on Facebook and Twitter!
General Lloyd Austin, the commander of all US forces in the Middle East, described the rescue operation as "complex and highly successful."
"We commend and congratulate the brave individuals who participated in this successful operation that saved many lives, and we deeply mourn the loss of one of our own who died while supporting his Iraqi comrades engaged in a tough fight," he said.
Those freed included prisoners who were about to be executed as spies, and residents of Hawijah, a coalition official in Iraq said.
"They'd executed four the previous day. We had seen mass graves had been dug on that compound and the information we now hear... is that they'd been told they would be executed after morning prayers this morning," the official told AFP.
An intelligence official in the Kurdish-controlled city of Kirkuk, speaking on condition of anonymity because he is not authorized to talk to the press, told AFP that "high value detainees" were believed to be among those captured.
He said the captives were being held in what was formerly the house of a local judge.
A Hawijah resident said that after the raid IS leaders in Hawijah "all went missing."
"The Daesh leaders in Hawijah all went missing after the raid. Their offices are closed and nobody knows where they went," the resident said, asking not to be identified by name. Daesh is an Arabic acronym for Islamic State.
Another local resident said, "The group's top Hawijah leader was detained and another senior leader too. A number of them were killed and several of the people held in that prison were freed."
Colonel Steve Warren, the coalition spokesman in Iraq, said US pressure has "begun to sow a bit of paranoia inside the organization."
"We've killed 70 of their mid- and high-level leaders since May, that's an average of one every two days, so we are putting pressure on their leadership. And we've seen that this creates a level of paranoia... that causes them to interrogate their own people," he said.
- US ties to Kurds -
Kurdish peshmerga forces control Kirkuk and have long worked closely with the US-led coalition.
Iraqi security and allied paramilitary forces have in recent days been closing in on Hawijah from the south and west. The city lies about 240 kilometers (150 miles) north of Baghdad.
Kurdish peshmerga forces, backed by US-led coalition air strikes, have also in recent weeks moved several kilometers closer to Hawijah, pushing down from the north and east.