Egyptian Christians
Masked militants led Egyptian Coptic Christians along a beach moments before they were simultaneously beheaded in February 2015. Getty Images

More than 45,000 Egyptians living in Libya have fled the North African country since the Islamic State group posted a video last month purporting to show the beheading of 21 Coptic Christians, many of whom were Egyptian, according to Agence France-Presse. Egyptian Copts have been increasingly subject to attacks by militants from the Islamic State group, leading Cairo to urge Egyptians to return home from Libya, which is plagued by political turmoil and a growing threat of extremism.

Hundreds of thousands of Egyptians live and work across the western border in Libya, while sending money back home to their families. Many enter the conflict-torn nation illegally, which makes it difficult to track the exact number of Egyptians in Libya.

By Friday, however, roughly 11,500 Egyptians in Libya had returned home via flights from Tunisia -- which is west of Libya -- and another 34,000 Egyptians had crossed into Egypt on the ground from Libya, AFP reported, citing state media and civil aviation ministry spokesman Mohamed Rahma. Some of the flights were chartered by Cairo.

After the hostage beheadings, Egypt authorized airstrikes on Islamic State group targets in Libya, including a stronghold in Derna that the militant group -- also known as ISIS or ISIL -- took control of amid political chaos and fierce fighting among rival factions.

ISIS also recently took control of at least two cities along Libya’s Mediterranean coast since seizing territory in Iraq and Syria last year, and there are now some 75,000 ISIS fighters countrywide. Militants across Libya have pledged allegiance to ISIS in recent months and have formed chapters in Sirte, Benghazi and even the capital Tripoli, according to CNN.

ISIS’ Libyan branch claimed responsibility for an attack on a luxury hotel in Tripoli that killed 10 people in January, CNN reported at the time. Two of the gunmen who attacked a national museum Wednesday in Tunisia’s capital received weapons training in Libya. The Islamic State group claimed responsibility for the attack, which killed 21 people, including 17 foreign tourists.

Seth G. Jones, director of the RAND Corp.'s International Security and Defense Policy Center, said Western nations should address the dire conflict in Libya before turning to Tunisia. "The challenge is, I think, that both the U.S. and Europeans waited way too long on Libya," Jones told International Business Times on Friday when discussing the attack in Tunisia. "And what you don't want to happen in Tunisia is the government to go in the direction that Libya went in."

European Union leaders vowed Friday to help stabilize the restive country and voiced support for the peace process brokered by the United Nations, the Associated Press reported. "There must be an immediate and unconditional ceasefire, and rapid agreement on a government of national unity," European Council President Donald Tusk said after hosting an EU summit in Brussels, according to AP.

But the 28-member bloc ruled out sending troops unless there was an official request from the United Nations or an invitation from Libya, which has two governments and parliaments, and both sides are aligned with rival armed factions.

Libya’s internationally recognized government bombed Tripoli’s only functioning commercial airport Thursday, Reuters reported. No casualties were reported, but the airstrikes on Matiga airport damaged the runway, delaying the trip of a rival parliament delegation to Morocco for U.N.-hosted peace talks intended to coax Libya’s warring parties into forming a new national government.

Alessandria Masi in New York contributed to this report.