UN rights chief condemns 'vile' beheadings of Christians in Libya
An image grab taken from a propaganda video released on March 17, 2014 by the Islamic State's Al-Furqan Media allegedly shows IS fighters raising their weapons as they stand on a vehicle mounted with the trademark jihadist flag in Iraq (AFP)

The United Nations human rights chief on Tuesday condemned the mass beheadings of Egyptian Christians in Libya and urged Libyans to fight Islamist extremists in their country.

"The brutal murder of these men, and the ghastly attempt to justify and glorify it in a video, should be roundly condemned by everyone, in particular by the people of Libya who should resist the urgings of takfiri (Sunni extremist) groups," UN High Commissioner for Human Rights Zeid Ra'ad Al Hussein said in a statement.

Islamic State militants in Libya posted a video on Sunday showing the decapitation of 21 Coptic Christians who were in the country seeking work.

"Murdering captives or hostages is prohibited under international law and Islamic law," he said, denouncing what he called a "vile crime targeting people on the basis of their religion."

UN human rights staff said Egyptian Coptic Christians have been abducted before in Libya.

In one case in December, "the bodies of three members of a Coptic Christian family were found in Sirte," the high commissioner's office said.

"Churches and other religious sites have also been attacked in Libya over the past three years," it added.

Zeid meanwhile urged Egypt to avoid civilian casualties, after it launched air strikes on Islamic State group targets in Libya in retaliation for the beheadings.

The air raids were ordered hours after IS militants released the gruesome video.

"The Egyptian air force must ensure full respect of the principles of distinction between civilians and fighters, and civilians objects and military objectives," Zeid said.

The International Organization for Migration voiced concern about the situation for foreigners in general in increasingly lawless Libya.

The organisation "is daily seeking to repatriate workers who are stranded in Libya," spokesman Joel Millman told reporters in Geneva.

A big obstacle to repatriating them, he said, is that many workers do not have their work or travel documents because their employers kept them or they misplaced them in the chaos that has gripped Libya.

UN refugee agency spokesman Adrian Edwards also warned that foreigners in general were "feeling dangerously exposed" in Libya.

The situation was prompting foreigners to leave the country in droves, he said, saying "more people are being pushed to the point of risking their lives by taking to sea crossings heading towards Europe."

According to IOM, at least 3,800 migrants have been rescued from the Mediterranean since Friday after setting off from Libya.