LONDON Algeria's swift use of lethal force against Islamist fighters who seized one of its main gas fields raised concerns in the West but came as no surprise at home and showed clearly how the government would respond to future jihadist attacks.
By the time special forces had cleared the In Amenas complex at the weekend, nearly 70 hostages and militants lay dead. Some Western leaders seemed unaware of what was happening on the ground, complaining that they had not been consulted about the decision to go in with foreign hostages' lives at stake.
For the Algerian leadership, the decision to attack with helicopters, snipers and special forces to tackle insurgents who had threatened to blow up the plant was apparently an easy one and the operation was seen as a success that has boosted the prestige of the armed forces.
"We are proud of our army's special forces and the whole world has understood that this reaction was the only possible response," Prime Minister Abdelmalek Sellal said. "When the security of the country is at risk, you have to be firm."
That reaction was clearly conditioned by the turbulent recent history of a country that jealously guards its sovereignty and sees those it regards as Islamist "terrorists" as a threat that must be snuffed out. And with a war in progress in neighbouring Mali, it is a threat that looms larger now.
Algeria fought a bitter war of independence against France in the 1950s and an even bloodier civil war against Islamist insurgents in the 1990s that cost 200,000 lives. Its leadership is secretive, authoritarian and determined to preserve the state in the face of Islamist unrest.
Oil and gas account for the bulk of Algeria's export earnings and the funds enable the government to subsidise food and fuel prices and cushion the effect of unemployment, particularly among the young.
Hydrocarbon wealth enabled Algeria to dodge the upheavals of the Arab Spring and experts believe that any further Islamist attacks on its oil and gas industry will be met with force by a security establishment determined to maintain the status quo.
More Islamist attacks are likely, but they are expected to be smaller, with foreign workers at risk from shootings and bombings. The security forces will deal with them firmly, said Richard Jackson, Deputy Director of Violent Risk Forecasting at the Exclusive Analysis consultancy.
"They are likely to respond in a forceful and rapid way to any future events," he said.
Prime Minister Sellal has been at pains to stress that the problem his country faces is not related to Islam, but to terrorism and banditry.
"I particularly call on Arab countries, in order to tell them that we are not facing an Islamic issue, but terrorists and mercenaries," he said.
"We must protect our religion, our civilisation, which terrorists are destroying. How can we imagine that such an acts are perpetrated on behalf of Islam. These crimes will not be allowed in Algeria."
The leader of the group behind the In Amenas attack, Mokhtar Belmokhtar, is known to be active in cigarette smuggling and kidnap and ransom, which many see as undermining any claim to purely religious motivation.
Some in Algeria suggest, however, that the military response to religious radicalism may not be effective on its own. A repositioning of religious values away from those espoused by foreign teachers may be necessary.
"Military combat against Salafi jihadists is needed, but it is not enough. We must also combat their ideology by returning to our values, our religious references," said Mohamed Mouloudi, an independent analyst on Islamic issues.
"Algeria doesn't need Saudi muftis to tell its citizens what is permitted and what is not, as is the case now. We must reform our education system, we must reform the way the government handles religion. If not, we will very soon become an annexe of Salafi ideology."
Although the In Amenas attack was plotted in Mali and involved foreign jihadists, Al Qaeda in the Islamic Maghreb can be found in Algeria.
Algerian libraries today contain religious texts originating mainly in Saudi Arabia, written by scholars who endorse the hard-line Wahhabi ideology, Mouloudi said.
"I am not saying they are all terrorists, but I am saying the ideas they promote clash with our values and our culture," he said.
In the meantime, however, one beneficiary of the In Amenas operation may be the Algerian military, whose political influence could be boosted as the country approaches an election in which it is unclear whether Abdelaziz Bouteflika, in power since 1999, will stand.
"The successful military assault has boosted the Algerian army's popularity among the people, which is an important factor 15 months ahead of a presidential election in which the military could play a major role in promoting a candidate," said an Algerian analyst, who asked not to be named because of the sensitivity of the issue.
The Pentagon releases photographs linked to allegations of abuse of detainees in Iraq and Afghanistan.