A band of heavily armed terrorists willing to die for their cause; explosives in a huge gas facility; an international workforce held hostage in one of the remotest spots on earth in a country whose army is a by-word for brutality: the chances of a peaceful resolution to the Algerian hostage crisis never looked good.
In some ways it is surprising so many appear to have escaped with their lives in its savage denouement. It would have been too easy to accuse the Algerian army of a gung-ho approach, which appears to have resulted in the deaths of several hostages, along with some of their captors. David Cameron was careful to avoid being openly critical, while rightly making clear his disappointment at the Algerian Government's rejection of specialist British "technical and intelligence support" when the initial attack happened.
An attempted break-out by a group of the terrorists, along with some hostages, left no time to phone London or Washington.
In his statement yesterday, the Prime Minister advisedly left some questions unanswered, including precise numbers of British workers unaccounted for, which could have provided information of use to the hostage-takers. As in other grave or perilous situations, this one seemed to bring out the best in Mr Cameron. He brings a measured gravitas and focus to such situations that other leaders struggle for. Politically, it has the same impact as moments of national celebration, such as the Olympics, in stressing the "United" in UK. He was right to postpone once more his speech on EU reform, though that is a subject that will continue to threaten the unity of his party. British lives were more important than European opt-outs.
The ramifications of this incident will be serious and could threaten more oil price shocks. Security at this plant was already tight. It will be even harder to persuade both Algerian and foreign workers to risk their lives in such places, threatening the development of oil and gas in west Africa. This is just what the terrorists want, of course. By damaging Algeria's natural gas infrastructure, they hope to undermine the country's military Government. Tensions run deep following a civil war sparked by the army's refusal to accept the election of an Islamist party in the 1991 elections. It claimed 100,000 lives.
Paradoxically, it is also the indirect result of the Arab Spring, the fall of Colonel Gaddafi and the unravelling of the complex relationships and power deals the dictator used to hold rival factions in check. Now these groups, one of which mounted this attack, are fighting for control of this vast, unstable desert region.
To address the challenges, Mr Cameron and his Foreign Secretary will require a different skill set. In Algeria as in Afghanistan, Iraq, Syria and, for the French, in Mali, that means attempting to split off local groups with whom dialogue is possible from those committed to the perversion of Islam that expresses itself in jihadi extremism and an absolute disregard for human life.
We moderate all comments on HeraldScotland on either a pre-moderated or post-moderated basis. If you're a relatively new user then your comments will be reviewed before publication and if we know you well then your comments will be subject to moderation only if other users or the moderators believe you've broken the rules, which are available here.
Moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours. Please be patient if your posts are not approved instantly.