US-Iraqi forces have rescued dozens of hostages held by Islamic State (IS) in Iraq after learning of their "imminent execution", the Pentagon has said.
But a US soldier wounded in the raid died of his injuries - the first killed in action since US operations against IS began last year.
The early morning operation on Thursday took place near the town of Hawija in northern Iraq.
Five IS militants were captured and a number killed, the Pentagon said.
About 70 hostages were rescued, defence officials said, including Sunni Arabs, 20 Iraqi security force members and IS members being held as suspected spies. No Kurds were rescued, the Pentagon and Kurdish officials said, despite initial reports to the contrary.
A Kurdish intelligence source however told the BBC only 17 were rescued, all former IS militants. He said the operation's aim was to capture prisoners who had defied orders of their IS leaders.
The raid targeted an IS-held prison near Hawija, in the predominantly Kurdish province of Kirkuk.
The US military was involved at the invitation of the Kurdistan regional government, the Pentagon said.
It said American helicopters flew troops to the site, with Kurdish special forces taking the lead but with US ones on the ground.
"This operation was deliberately planned and launched after receiving information that the hostages faced imminent mass execution," Pentagon spokesman Peter Cook said in a statement.
"It was authorised consistent with our counter-ISIL effort to train, advise, and assist Iraqi forces," he added, using an alternative acronym for IS.
Questioned on whether the action represented "boots on the ground", defying previous commitments from President Obama, Mr Cook stressed the rescue was a "unique circumstance" and not a change in tactics.
Another Pentagon official, Captain Jeff Davis, said they had acted on "troubling intelligence" having seen signs of mass graves being dug.
Despite assurances from the Pentagon, some US media commentators wondered if the military had broken promises not to get involved in direct fighting.
"How is joining a fire-fight with #ISIS inside a walled compound deep in northern #Iraq not ground combat?" tweeted Jim Sciutto, CNN's Chief National Security Correspondent.
Dave Maxwell, a former Army Special Forces, told the Washington Post the US had a dilemma in how far they could support allies against IS.
"How much do you build rapport, and how much do you actually help these guys accomplish the mission?" he asked.
For Nancy A Youssef writing in the Daily Beast the raid marked "the latest game of military semantics in a war defined as much by its messaging as by its tactical results".
The US soldier killed was said to have come under fire from IS militants during the operation.
Gen Lloyd Austin, who heads the US military's Central Command, said "we deeply mourn the loss of one of our own who died while supporting his Iraqi comrades engaged in a tough fight".
A US-led coalition has been carrying out daily air strikes on IS positions in Iraq and Syria for more than a year.
The raid on the prison in northern Iraq comes amid a fresh push by Iraqi and Kurdish forces to capture territory seized by IS.