By Toby Harnden - August 25, 2014

It was shortly after midnight on the Fourth of July when the specially modified Black Hawk helicopters fitted with radar-evading equipment swooped down over Ukayrishah, a small town next to the Euphrates River, close to the northern Syrian city of Raqqa.

Flown by pilots from the US 160th Special Operations Aviation Regiment — known as the “Night Stalkers” — the Black Hawks’ first job was to destroy a jihadist anti-aircraft battery three miles away. But their main role was to drop several dozen elite troops from Delta Force and SEAL Team 6, the unit that killed the al-Qaeda leader Osama bin Laden in 2011, into the heart of territory controlled by Isis, or the Islamic State.

Syrian radar had been jammed and fighter jets were patrolling overhead as the commandos blocked access roads. The troops moved swiftly towards their objective: an abandoned oil refinery used as a military post and known as the Akershi base.

The CIA had concluded that the base contained a secret prison in which a number of western hostages were languishing.

James Foley, 40, an idealistic freelance journalist from New Hampshire who had once been kidnapped in Libya and held for 44 days, was thought to be among them.

When the commandos reached the base, scores of Isis fighters swarmed out. A US air force AC-130 gunship laid down a wall of fire, killing up to 15 of the jihadists.

According to locals, some of the commandos were wearing Jordanian insignia, perhaps to mask their nationality. They entered the buildings and found the prison. But the hostages were not there. The special forces troops had found what they term a “dry hole”.

The operation was reminiscent of the 1970 mission to free American prisoners of war from North Vietnam’s Son Tay prison camp. It was flawlessly executed but the North Vietnamese had moved the prisoners a day earlier.

For President Barack Obama the decision to send in the Night Stalkers was an agonising one. The audacious bin Laden raid in Pakistan had been a success but also preying on his mind was the failed 1980 Delta Force operation to rescue American hostages in Tehran.

Sandstorms and mechanical troubles led the mission to be abandoned and eight American troops were killed when two aircraft collided. The debacle cast a shadow over Jimmy Carter’s presidency.

Pentagon sources said Foley and the others might well have been rescued but Obama, concerned about the ramifications of US troops being killed or captured in Syria, took too long to authorise the mission.

Anthony Shaffer, a former lieutenant-colonel in US military intelligence who worked on covert operations, said: “I’m told it was almost a 30-day delay from when they said they wanted to go to when he finally gave the green light. They were ready to go in June to grab the guy [Foley] and they weren’t permitted.”

Another US defence source said: "The White House constantly goes back and forth on these things. These people are a bunch of academics who endlessly analyse stuff and ordering up another deep-thinking paper but can't decide what to order for lunch."

On the evening of August 13— five days after American airstrikes on Isis targets began — Foley’s parents John and Diane received an email from their son’s captors addressed to “the American government and their sheep-like citizens”.

America, it said, “will pay the price” for the bombings. “The first of which being the blood of the American citizen, James Foley! He will be executed as a direct result of your transgressions towards us!”

Last Tuesday a video lasting almost five minutes was uploaded to YouTube. It started with a clip of Obama announcing airstrikes to stop the slaughter of Yazidis in Iraq.

It then cut to a desert scene in which a masked jihadist swathed in black stood beside a kneeling Foley, who was pallid, his head shaved and dressed in an orange jumpsuit similar to those worn by Guantanamo Bay detainees.

The journalist, grimacing, recited a memorised anti-American propaganda message, part of it directed to his brother John, a US air force officer. “I call on you, John. Think about who made the decision to bomb Iraq recently and kill those people, whoever they may have been.”

Then the terrorist standing over him — who has since become known as “Jihadi John” — spoke in a London accent, concluding: “Any attempt by you, Obama, to deny the Muslims their rights of living in safety under the Islamic caliphate will result in the bloodshed of your people.”

He pulled the prisoner’s head back and began slitting his throat with his left hand using a 6in knife before the video shifted to Foley’s body, his bloodied head resting on his back.

Obama, whose aides said had not viewed the video, was briefed on its contents on Air Force One as he flew to resume his holiday on Martha’s Vineyard in Massachusetts.