Pentagon press secretary Peter Cook details a U.S.-Kurdish raid on an Islamic State prison in Iraq. One U.S. service member was fatally wounded, and about 70 captives were rescued. (U.S. Department of Defense)

American and Kurdish commandos raided an Islamic State prison in Iraq on Thursday, freeing about 70 captives believed to be facing “mass execution” and leaving one U.S. soldier dead, U.S. and Iraqi officials said.

It was the first time a member of the U.S. military had been killed in a combat situation in Iraq since President Obama pulled out all U.S. troops in 2011.

In a pre-dawn operation, soldiers from the Army’s Delta Force, supporting a team of elite Kurdish soldiers, descended on a militant compound in the town of Hawijah, where officials believed that dozens of Kurdish fighters known as peshmerga were being held captive.

Militants from the Islamic State, the extremist group that controls a vast area across Iraq and Syria, were planning an “imminent mass execution” of prisoners, Pentagon press secretary Peter Cook told reporters later in the day.

While peshmerga captives were not present at the site, the U.S. and Kurdish forces freed dozens of others, including more than 20 members of the Iraqi security ­forces, Cook said. Five Islamic State militants were captured, officials said, and at least 10 were killed. In a statement, the Kurdish Security Council said more than 20 militants were killed.

One soldier from the Delta Force team, which numbered in the dozens, was shot when U.S. forces entered the militant compound. He later died. The Pentagon has not identified the slain soldier.

U.S. and Kurdish officials hailed the raid — in which three or four Kurdish fighters were wounded — as a success. While U.S. Special Operations forces have staged several raids on Islamic State compounds in Syria since last year, Thursday’s operation was the first known raid of its kind against the jihadist group in Iraq.

The maneuver underscored the risks facing troops in Iraq despite the Obama administration’s efforts to keep U.S. forces­ far from combat and avoid the bloodshed of the last Iraq war, when more than 4,000 American service members died. There are now about 3,300 U.S. service members stationed in Iraq.

An Iraqi official said the Iraqi Defense Ministry in Baghdad learned of the operation from news media reports. He said that Defense Ministry officials were upset they had not been consulted before the operation.

Iraq’s Arab-led government has long sparred with Kurds over growing Kurdish power, oil revenue sharing and political independence in their northern enclave, and the United States has to balance these internal rivalries as it focuses on the Islamic State.

Hakim al-Zamili, chairman of the Iraqi parliament’s security and defense committee, said there were “lots of question marks” about an operation in which U.S. forces­ worked hand in hand with peshmerga forces­ far south of the northern Kurdish region where they have typically operated.

Islamic State's flag is seen in an area after Kurdish troops regained control of some villages west of the oil-rich city of Kirkuk, about 160 miles north of Baghdad, on Sept. 30. (AP)

“What happened today is a dangerous thing,” he said.

The office of Prime Minister Haider al-Abadi could not be reached for comment.

Since last year, after the rise of the Islamic State, a modest number of U.S. military advisers have returned to Iraq and deployed across the country, including in the Kurdish capital, Irbil, to train Iraqi and Kurdish force­s to fight the militants. U.S. and allied advisers are positioned in other areas of Iraq in an attempt to rebuild the Iraqi army, which partially collapsed last year amid an Islamic State assault.

After more than a year of U.S. and allied airstrikes against the militants, Iraqi forces­ are struggling to retake territory from the Islamic State, which is well armed, well funded and re­inforced by foreign fighters

Cook said that Defense Secretary Ashton B. Carter approved the raid, which was conducted as part of the U.S. training and advisory mission in Iraq. He said U.S. forces recovered “important intelligence” during the operation.

Dana Pittard, a retired U.S. major general who helped set up the anti-Islamic State mission in Iraq, said that even forces­ sent on an advisory mission could face an occasional firefight. “But it’s not like sending a U.S. brigade into contact,” he said.

According to Dave Maxwell, a former Army Special Forces officer and current associate director of Georgetown University’s security studies program, the joint Kurdish-U.S. raid illustrates the dilemma for U.S. advisers and the question of how far they are allowed to take their relationship with the units they are advising and assisting.

“How much do you build rapport, and how much do you actually help these guys accomplish the mission?” Maxwell asked.

In a statement, the Islamic State called the raid a “failed operation by the crusader coalition.” The group said that only three of its militants were slain and that the attacking forces­ had killed prisoners, an allegation the Pentagon denied.

Hawijah has been previously struck by U.S.-led warplanes seeking to weaken the Islamic State’s hold on parts of Iraq and Syria.

On Thursday, the United Nations refugee agency said an increasing number of people have attempted to flee Hawijah, but Islamic State militants are beating or killing those who try to escape.

That the raid did not liberate peshmerga forces­ as planned raises questions about the intelligence U.S. and local forces­ rely on as they seek to defeat the Islamic State.

A Kurdish official, speaking on the condition of anonymity to discuss the rescue mission, said that dozens of peshmerga had been captured by the Islamic State in the past year and that some were executed.

He said the need to mount a rescue operation had become more urgent as the Islamic State threatened to kill others in its custody, sometimes parading them in public in cages on the back of pickup trucks.

“It’s very clear that the United States, while it’s not committing huge numbers of troops on the ground, it is involved in Iraq and it should be involved,” said Bayan Rahman, the Kurdistan Regional Government’s representative in Washington. “Its involvement has saved lives.”

Gen. Lloyd J. Austin III, the head of U.S. Central Command, called the raid a “complex and highly successful operation” and offered his condolences to the family of the service member who was killed.

A senior defense official, speaking on the condition of anonymity to discuss the covert operation, said the U.S. forces­ returned to Irbil after the mission.

Salim reported from Baghdad. Adam Goldman in Washington and Erin Cunningham in Cairo contributed to this report.

Read more:

What a year of Islamic State terror looks like

U.S. launches secret drone campaign to hunt Islamic State leaders in Syria

Today's coverage from Post correspondents around the world