Beijing has vowed to bring ISIS to justice after the group said it had executed two hostages, a Chinese and a Norwegian.

ISIS said it had killed the two men, identified as Chinese national Fan Jinghui and Norwegian citizen Ole Johan Grimsgaard-Ofstad in its English-language online magazine Dabiq.

President Xi Jinping "strongly condemned" ISIS for the killing of Fan, the first known Chinese national to be killed by the group, and the country's foreign ministry said the Chinese government would "definitely hold the perpetrators accountable."

But how to respond to Fan's "cold-blooded and violent" death presents a dilemma for China, which has stayed on the sidelines in the fight against ISIS and has a long-held principle of noninterference in other countries' affairs.

To date, Beijing has been vague on the question of what it will contribute to the global fight against ISIS and has declined to explicitly offer its support for airstrikes being conducted against the group in Syria.

Norway also condemned the killings.

"We have no grounds to doubt the contents of the photos that have been published," Foreign Minister Boerge Brende said, according to Reuters.

The U.N. Security Council added their voice to the outrage on Friday, and called on all countries to cooperate with China and Norway to help bring those responsible for the killings to justice.

Teacher turned drifter

It's not known how Fan was captured by ISIS or whether he was abducted in Iraq, Syria or elsewhere.

Fan doesn't appear to have a military background and worked as a high school teacher before switching to a career in advertising, according to Chinese state media.

In 2001, according to Chinese magazine Caijing, he told a Chinese radio program that he was a "drifter" but he hoped to win awards for his advertising work.

When news of Fan's capture first spread in September, neighbors near his last known address told Reuters that he hadn't lived at the home in many years, and that they didn't know if he had any family.

"The Chinese government and people have been very concerned about Fan Jinghui's safety since he was kidnapped," Foreign Ministry spokesman Hong Lei said in a statement Thursday.

He added the government had made "all-out" efforts to rescue him.

China on the sidelines of ISIS fight

China hasn't been an active participant in the fight against ISIS, but, in the wake of the killing, pledged to "enhance its counter-terrorism cooperation with the international community."

But experts say the chances of Chinese aircraft flying alongside Russian and U.S. planes in Syria and Iraq are slim to none.

"It seems most likely that the Chinese government will continue to stay on the sidelines," said Xie Tao, a professor at Beijing Foreign Studies University.

Xie said there are multiple reasons for that. First, he said by officially declaring war on ISIS, Chinese officials fear that could draw further scrutiny from the group, and perhaps increase the chances of a Paris-style attack in China.

He also pointed to the notion of precedent.

If the Chinese were to join the anti-ISIS coalition, it would be a historic step in their foreign policy, ignoring a decades-old policy of nonintervention and potentially giving other countries leverage when asking China to take sides in future conflicts.

'For sale'

In September, the two men were pictured in the online magazine wearing yellow jumpsuits with the words "FOR SALE" below their portraits.

A warning appeared beneath their portraits at the bottom of each page: "Note: This is a limited time offer."

Norwegian Prime Minister Erna Solberg said in September that the kidnappers had asked for ransom several times but the Norwegian government did not pay ransom.

In its publication Dabiq, ISIS said the two men had been "executed after being abandoned by kafir nations and organizations."

ISIS has taken dozens of international hostages, often seeking ransoms for them to swell its coffers, but when money isn't forthcoming, it has publicized its barbaric killings to score propaganda points.