“We are investigating the circumstances of the combat deaths of the two Army Rangers in the beginning of what was an intense three-hour firefight,” the Pentagon spokesman, Capt. Jeff Davis, told reporters on Friday. He said it was “possible” that the two Rangers were struck by friendly fire.

The soldiers were killed in an action fighting the Islamic State in Nangarhar Province. They were taking part in a lengthy raid, supported by airstrikes from American warplanes, in Achin, a small district where a number of Islamic State fighters have been engaging in a long-running battle with Afghanistan security forces.

Achin is the same district where the Pentagon deployed the United States military’s most powerful conventional bomb two weeks ago. That weapon, nicknamed the “mother of all bombs,” targeted Islamic State fighters who were hiding in caves and a tunnel complex.

The Defense Department deemed the operation successful. But since then, fighting in the area has continued and the Afghanistan military, supported by the Defense Department, has yet to clear the area of remaining Islamic State fighters.

Captain Davis said the target of Wednesday’s deadly raid was Abdul Hasib, whom Defense Department officials called the emir of the Islamic State in Afghanistan. Pentagon officials said they could not confirm that he was killed in the operation.