The families of two journalists beheaded by Islamic State jihadists were both warned by US government officials they could face prosecution if they raised a ransom for their release.

The recent executions of James Foley and Steven Sotloff by Islamic State (IS) extremists triggered worldwide revulsion and Washington has since declared it is at war with the radicals.

The United States has a policy of never paying ransoms, contending that doing so would endanger Americans all over the world.

A spokesman for Sotloff's family has said the murdered journalist's parents were told by a White House counter-terrorism official last May that they could face prosecution if they paid a ransom in an attempt to secure the release of their son.

"The family felt completely and utterly helpless when they heard this," Barak Barfi told Yahoo News.

"The Sotloffs felt there was nothing they could do to get Steve out."

He added that Sotloff's father was "shaking" after the meeting with the official from the National Security Council.

The remarks followed similar comments by Foley's mother Diane, who told CNN in an interview aired this week that her family was warned it could be charged if it tried to come up with ransom money.

The family was also told no prisoners would be exchanged for Foley, nor would the government take military action, she said. It was also told not to go to the media and "trust that it would be taken care of."

The Sotloff's "heard the same thing the Foleys did," Yahoo News quoted Barfi as saying.

Murdered journalist James Foley.

Secretary of State John Kerry responded to Foley's remarks Friday, saying he was "really taken aback" and that he was "totally unaware and would not condone anybody" at the State Department making any threatening statements.

Meanwhile, White House spokesman Josh Earnest said long-standing US policy forbids paying ransoms because doing so "only puts other Americans in a position where they're at even greater risk."

He referred questions about whether the Foleys would have been prosecuted to the Justice Department.

But he said President Barack Obama used "every tool at our disposal" to try to free Foley, including a "high-risk" military rescue attempt.

Islamic State militants released a video of Foley's beheading on August 19, followed in early September by footage of Sotloff's killing.

Foley, 40, had covered wars in Afghanistan, Libya and Syria and contributed to GlobalPost, Agence France-Presse and other outlets.