By Ahmed Tolba and Michael Georgy

CAIRO (Reuters) - Islamic State released a video on Sunday that appeared to show the beheadings of 21 Egyptian Christians in Libya and President Abdel Fattah al-Sisi warned that his country would respond to the deaths as it saw fit.

Speaking on national television hours after the release of the video, Sisi said Cairo would choose the "necessary means and timing to avenge the criminal killings".

Egypt's state news agency MENA quoted the spokesman for the Coptic Church as confirming that 21 Egyptian Christians believed to be held by Islamic State were dead.

The beheadings could stiffen Sisi's resolve in dealing with security threats from militants thriving in neighboring Libya's chaos who want to topple his U.S.-backed government.

Egypt has denied reports in the past that it had taken part, along with its close ally the United Arab Emirates, in air strikes against militants based in Libya.

The footage showing the deaths of the Egyptians appeared on the Twitter feed of a website that supports Islamic State, which has seized parts of Iraq and Syria and has also beheaded Western hostages.

In the video, militants in black marched the captives, dressed in orange jump suits, to a beach the group said was near Tripoli. They were forced down onto their knees, then beheaded.

A caption on the five-minute video read: "The people of the cross, followers of the hostile Egyptian church." Before the killings, one of the militants stood with a knife in his hand and said: "Safety for you crusaders is something you can only wish for."

Thousands of Egyptians desperate for work have traveled to Libya since an uprising at home in 2011, despite advice from their government not to go to a country sliding into lawlessness.

Sisi, who met with the country's top military commanders to discuss the killings, called for a seven-day mourning period, state television reported.

The Coptic Church said it was confident the government would seek justice. Al Azhar, the center of Islamic learning in Egypt, said no religion would accept such "barbaric" acts.

Story continues

The families of the kidnapped workers had urged Cairo to help secure their release. In the mostly impoverished southerly Minya Governorate, relatives screamed and fainted upon hearing news of the deaths.

CONCERNS ABOUT LIBYA

Egypt, the most populous Arab state, has not taken part directly in the U.S.-led air strikes against Islamic State targets in Iraq and Syria, focusing instead on the increasingly complex insurgency within its own borders.

Militants based in Libya have made contact with Sinai Province, a group operating from Egypt's Sinai Peninsula that has changed its name from Ansar Beyt al-Maqdis and pledged allegiance to Islamic State.

The group has killed hundreds of Egyptian soldiers and police since the army toppled Islamist president Mohamed Mursi in 2013 after mass protests against his rule.

With Libya caught in a chaotic power struggle between two rival factions operating their own governments, Western officials worry that Islamist militants are taking advantage of the turmoil to strengthen their presence.

A number of Islamist militant groups have been active since the fall of Muammar Gaddafi in 2011 left Libya without a strong central government. A few have declared ties to the radical Islamic State and claimed high-profile attacks over recent weeks in what appears to be an intensifying campaign.

Fears that the crisis in neighboring Libya could spill across the border have prompted Egypt to upgrade its military hardware. French President Francois Hollande has said Egypt will order 24 Rafale fighter jets, a naval frigate and related military equipment in a deal to be signed in Cairo on Monday worth more than 5 billion euros ($5.7 billion).

(Editing by Kevin Liffey and Frances Kerry)