document: It has gained a foothold in key towns and cities in the mostly lawless North African state, prompting Egypt - seeing itself as the bulwark against Islamists in region - to launch air strikes against the group.
  After the two war-ravaged Middle Eastern states, IS has launched its most high-profile attacks in Libya, bombing an upmarket hotel in the capital, Tripoli, in January, and releasing a video earlier this month showing the beheading of 21 Egyptian Coptic Christians it had kidnapped. On 20 February, it killed at least 40 people in a suicide bombing in the eastern town of al-Qubbah.
  For UK-based Libyan academic, Mohamed Ahdash, the emergence of IS affiliates in Libya is not surprising.
  "There is a study which shows that after Saudi Arabia, most of the fighters who went to Syria were from Libya," he told the BBC.
  Libya's internationally recognised government believes the fighters are now returning, following a shift in IS thinking to promote local jihad, and are under the command of a Tunisian named Abu Talha.
  The North African state, Middle East Monitor publication analyst Nasim Ahmed points out, is an obvious target for IS.
  It is a gateway to Europe, and has been chaotic since the overthrow of long-serving ruler Muhammar Gaddafi in a Nato-backed offensive in 2011, with two rivals governments, dozens of groups armed with weapons looted from the former regime's arsenal and smugglers who roam freely across porous borders in the desert region.
  "It is a failed state. Unlike other countries in the region, it does not have a semblance of government. This makes it the most vulnerable," he told the BBC.
  Moreover, Libya is rich in oil and, earlier this month, gunmen claiming to represent IS raided a French-run oil facility in al-Mabruk, south of Sirte city, killing at least 11 guards.
  "They are able to attack oil pipelines, but as of yet lack the capability to sell smuggled oil on the open market. Nonetheless, many IS-aligned fighters collect salaries from the Libyan state," Jason Pack, a researcher in Libyan history at the UK's Cambridge University, told the BBC.
  Libya's rival power bases
  Has Libya been let down by the West?
  Fighting for the spoils of Libya's revolution
  Why is Libya lawless?
  Mr Ahdash says Libya has become a magnet for jihadis from other parts of Africa - especially those who fled northern Mali after a French-led military operation recaptured territory from them in 2013.
  "They are under one umbrella, but they are very different and very divided. It is difficult to work out who is who," he says.
  He says Islamists had a presence in Libya during Col Gaddafi's rule, but they were heavily suppressed.
  So it does not surprise him that they have now gained a foothold in cities like Benghazi, the cradle of the 2011 revolution that overthrew Col Gaddafi, and Derna, the coastal town being targeted by Egypt's military and where the first IS affiliate emerged in October.
  But what surprises him, Mr Ahdash says, is that they have secured a presence in Sirte, the birthplace of Col Gaddafi, which had been seen as hostile towards Islamists.
  He says either foreign jihadists have infiltrated the city or Gaddafi loyalists, including military officers, have joined the militants, just as they did in Iraq after Saddam Hussein was overthrown by US-led forces in 2003.
  "I'm worried that could happen in Libya; that there could be a marriage of interest," says Mr Ahdash, pointing out that Ahmed Gaddafi al-Dam, an influential cousin of the former ruler, has publicly hailed IS as "pure".
  Nevertheless, he does not believe IS or its affiliates have a huge presence in Libya.
  "Most Libyans are moderate Muslims, and they hate Daesh," Mr Ahdash told the BBC, referring to the name by which IS is known in the Arab-speaking world.
  Patrick Skinner, a former CIA case officer, is quoted by Foreign Policy magazine as saying that there are an estimated 1,000 to 3,000 fighters loyal to IS in Libya, many of whom acquired combat experience in Iraq and Syria.
  IS-linked fighters operate in Tripoli, the south-western region of Fezzan, and the eastern region of Barqa, which includes Benghazi and Derna.
  However, Thomas Joscelyn, senior editor of the Long War Journal, says that while IS has grown in Libya, its strength should not be exaggerated.
  "These zones are more aspirational than they are real," Mr Joscelyn told Foreign Policy.
  Even if IS control in Libya is limited to a few small areas, it still has the potential to make the country's desperate situation even worse.
  "There is a massive vacuum of power in Libya, and no central authority to repel IS. It thrives in conflict," says Mr Ahmed.
  Mr Pack points out that the country has three main power blocks:
  "There is a civil war between the two main groups [Libya Dawn and Operation Dignity]. The jihadists act as spoilers," Mr Pack says.
  He is opposed to Egypt's military intervention, saying it could make the internationally recognised government wrongly conclude that it could defeat its rivals - a perception that has grown following its 23 February decision to withdraw from UN-brokered peace talks.
  "You need a national unity government to tackle IS. It is in Libya because the political process has failed," Mr Pack told the BBC.
summary: The Islamic State (IS) has wreaked havoc in the Middle East, seizing vast areas of Iraq and Syria and now it is taking advantage of Libya's collapse into anarchy.