Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

ISIS dismissed as a failure the U.S. and Kurdish raid that rescued dozens of hostages who officials said were about to be slaughtered by the militant group in northeastern Iraq.

The group's statement also called it a cowardly operation.

U.S. officials said on Thursday that one American soldier had been shot to death in the firefight at a prison in the town of Hawija, 34 miles southwest of Kirkuk.

American military officials said they responded to a request from the Kurdish regional government in Iraq, which had learned that the hostages faced "imminent mass execution," perhaps within hours.

"Mass graves were already dug," according to a senior U.S. military official with direct knowledge of the raid.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

ISIS said that three of its militants died during the raid, according to a translation of the statement by security firm and NBC News intelligence consultant Flashpoint.

"This successful operation that saved many lives, despite the casualty"

According to the Pentagon, ISIS fighters were killed in the overnight raid, and five others were handed over to Kurdish authorities.

The commandos rounded up 75 hostages, a group that included more than 20 members of the Iraqi security forces. Fifty of the hostages were civilians and another five were members of ISIS who were being held prisoner by their colleagues, a senior defense official told NBC News.

"We commend and congratulate the brave individuals who participated in this successful operation that saved many lives, despite the casualty," Gen. Lloyd Austin, commander of U.S. Central Command, said in a statement.

The operation marked the first known instance of American service members battling ISIS fighters on the ground in Iraq under President Barack Obama's new mission to "train and advise" local forces against the militants who have taken over swaths of Iraq and neighboring Syria.

Related: ISIS Attacks Soared in Past 3 Months, Analyst Say

U.S. officials stressed that the raid did not signal a change in the mission, in which Obama has tried to avoid putting American "boots on the ground" in the battle against ISIS. Obama said as far back as February that American involvement could include rescue missions or the use of special operations forces.

Secretary of Defense Ash Carter signed off on the 2 a.m. raid, in which America provided helicopters to transport the commandos to the prison. When they hit the ground, Kurdish peshmerga fighters led the way, with backup from U.S. commandos, Pentagon spokesman Peter Cook said Thursday.