Last week\'s hostage-taking has rocked the image of Algeria\'s powerful security apparatus, raising questions about how gunmen could have overrun the key In Amenas gas field, with alarming implications for the energy sector. As foreign governments continued to count the human cost of the attack, in which 37 foreign workers were killed, Algiers has scrambled to contain the fallout from its inability to stop the world\'s deadliest hostage crisis in almost a decade. Energy Minister Youcef Yousfi pledged to beef up security at oil and gas sites, and President Abdelaziz Bouteflika ordered an enquiry into the \"security failure\" that allowed heavily armed Islamists to seize hundreds of hostages. After years of relative quiet, during which the army managed to largely curtail the operations of Al-Qaeda in the Islamic Maghreb, the local affiliate of the jihadist network, Algeria\'s vulnerability in a region swept by change has been laid bare. \"Most people think that the civil war ended in 2002, but in fact it just changed into a low intensity conflict. Then the events in Libya and Mali breathed new life into it,\" said International Crisis Group\'s north Africa director William Lawrence. Algeria\'s two neighbours have both witnessed violent upheavals -- with the 2011 uprising that ousted Libya\'s Moamer Kadhafi, fuelling regional instability, and the seizure of northern Mali by Islamists last year. The bloody chaos that engulfed Algeria in the 1990s left up to 200,000 people dead. Yet the oil and gas sector -- the life-blood of the economy -- was largely unscathed, making the In Amenas attack the biggest of its kind. \"The attack obviously came as a surprise, but it does underline the chronic level of instability in the region and how that can impact dramatically on projects,\" said regional energy expert Rafiq Latta.\"I think the attack will change the cost structure for the foreign firms, in terms of risk, and how much the contractors will want to be paid,\" he said, adding that Algeria was already struggling to attract investment. The Algerian energy sector depends on foreign investment. Britain\'s BP and Norway\'s Statoil, along with Algeria\'s Sonatrach, jointly operate the In Amenas wet gas project, the country\'s largest, which generates nearly $3 billion (2.3 billion euros) a year, according to an Algeria security analyst. He described the failure to prevent the attack as a \"catastrophe,\" saying it was \"unbelievable that they neglected or economised on security measures\" at the plant. The In Amenas plant lies deep in the Sahara, 1,300 kilometres (800 miles) southeast of Algiers and just a short ride from the border with Libya, where the chaos following the 2011 conflict scattered weapons across the region. Other major upstream developments are equally exposed, including In Salah, another gas plant run by BP and Statoil, and a number of planned gas projects, which are all closer to Mali, which lies to the south. \"The point to make in Algeria is that they are moving south. The next big hydrocarbons area to be opened up is the southwest, which is even more vulnerable,\" said Rafiq Latta. International oil firms are all too familiar with the dangers of operating in countries harbouring armed insurgents, from Iraq to Nigeria, with the financial rewards of doing so often outweighing the risks. The In Amenas attack has sent \"shock waves\" through the foreign oil and gas community in Algeria, but it\'s \"extremely unlikely\" that there will be a mass exodus, argues Geoff Porter, who runs a political risk firm specialising in North Africa. \"How companies respond will depend a lot on what the investigation throws up. Was it an inside job? Did it originate in Algeria? What were the intentions? I think that will to an extent determine the degree to which it is replicable,\" he told AFP. Algeria\'s response to the In Amenas attack was ruthless and sent a firm message of deterrent, but also raised concerns among foreign leaders, at least initially. The government swiftly rejected negotiations and the special forces launched an assault that killed all but three of the 32 insurgents. But damage has been done to the image of a country that prides itself on its powerful military and intelligence capabilities, a key aim of the militants, who \"definitely had inside knowledge,\" ICG\'s William Lawrence said. \"Their goal was to destabilise Algeria by showing up the authorities and hurting reputations.\"