EDGARTOWN, Mass. — A secret nighttime military mission authorized by President Obama to rescue Americans held captive in Syria failed early this summer when a team of two dozen Delta Force commandos raided an oil refinery in the northern part of the country but found after a firefight with Islamic militants that there were no hostages to be saved, administration officials said Wednesday.

The officials — speaking a day after the Islamic State in Iraq and Syria posted a video showing the American journalist James Foley being beheaded — described what they called a “complicated operation” in which the commandos were dropped by helicopter into Syrian territory in an attempt to rescue Mr. Foley and others being held by the Sunni militant group.

The Army commandos fought their way to the spot where they believed that ISIS was hiding the hostages, the officials said. But when the team swooped in, the hostages were gone. “We’re not sure why they were moved,” a Defense Department official said. “By the time we got there, it was too late.” The official said it may have been “a matter of hours, perhaps a day or two” since the hostages had been there.

One of the American commandos was slightly wounded in the skirmish, which lasted several minutes before American aircraft flew the soldiers to safety. At least one of the aircraft came under fire, but all members of the team were evacuated successfully. The administration officials said they believed a number of the terrorists were killed.