For months, Algerian officials repeated their mantra that large foreign exchange reserves would shield the country from collapsing oil prices. Last week, Prime Minister Abdelmalek Sellal took to state television to announce what most already knew - that crisis was at the door.
With crude prices having more than halved since June, Algeria must plot a precarious path of curbing high public spending without eating into a generous welfare budget that has helped stave off widespread social unrest.
The price slide is testing an economic system that relies on energy revenues to pay for social subsidies, from public housing to cheap loans, which helped Algeria avoid the kind of "Arab Spring" uprisings that erupted in its North African neighbours.
The balancing act to come is crucial as Algeria's seeks more foreign investment to help increase energy output - source of 60 percent of state revenue - which has remained largely stagnant for the last three years.
Sellal has announced a public-sector job-hiring freeze covering most areas except energy, health and education.
Several planned urban tramway and railroad projects across the country will be postponed, the prime minister said, while an expansion of Algiers airport will be financed through bank loans, rather than being state-funded.
"We are not talking about austerity, we are talking about rationalising spending," he said in a national broadcast. "We are now in crisis, but Algeria has anticipated this."
Decisions are being made at a sensitive time for Algeria's leadership, with questions lingering over the health of ageing President Abdelaziz Bouteflika, who has rarely been seen in public since a stroke in 2013, even after re-election last year.
Cushioned by nearly $200 billion in foreign exchange reserves, no-one sees Algeria for now facing the kind of storm brewing over fellow OPEC member Venezuela, where Moody's (MCO) ratings agency has warned of an increasing risk of economic collapse.
But some economists say the limited measures announced so far will do little to plug a budget deficit officially forecast at 22 percent of gross domestic product (GDP) in 2015, based on oil at $90 a barrel - almost double the current price.
They say there is little room for manoeuvre as cuts to welfare spending appear are out of bounds, for now, in a country with a history of socialist and centralized economic policies.
Analysts expect more infrastructure projects may be delayed, and say more opportunities in non-energy industries, such as housing and farming, may open for private, and foreign, investment to free up state funds.
Social Stability
"Authorities are likely to prioritise social stability over fiscal responsibility in the short term, in the expectation that the current fall in oil and gas prices will not last for longer than one or two years," said Eurasia Group analyst Riccardo Fabiani.
"This is likely to be sufficient to contain political and social unrest to a series of localised, single issue-driven protests."
The government also said it would introduce tougher import licence restrictions to try to limit imports, as a way to protect its foreign reserves used to pay overseas suppliers. But few details have been disclosed.
It has not put a figure on how much it wants to cut public spending or how much the measures announced will counter the fall in prices of oil, which accounts for 97 percent of exports.
But the 2015 budget had in December already set out a 16 percent increase in state spending to $112 billion for the year. Spending on subsidies - on everything from milk and cooking gas to electricity and housing - represents 30 percent of GDP.
The public sector provides about 60 percent of jobs.
"Algeria cannot move quickly from a social economy to a liberal one," said Abdelmalek Serrai, a business consultant and former presidential adviser. "It has been spending too much on this, but it cannot change its subsidy policy."
The sensitivity of social spending was illustrated last week after Finance Minister Mohamed Djellab told lawmakers Algerians would one day have to start paying their own bills for public hospitals and housing.
Djellab may have been speaking about the future, but El Watan newspaper's front page on Wednesday captured the mood: "The state wants to abandon social spending" ran a banner above a cartoon of a man wobbling across a tightrope.
Many of Algeria's 40 million people recall the 1986 oil price crash, which triggered widescale riots, near economic collapse and reforms to end a one-party political system.
It also preceded a decade of Islamist conflict in Africa's biggest country by area, whose stability is closely monitored in the West as it is a key gas supplier to Europe and a U.S. ally in its fight against Islamist militancy in the Sahel.
Still, Algeria is in a much better shape than in 1986, with foreign exchange reserves of around $185 billion and little foreign debt after using 1990s oil boom times to shore up its finances and pay off obligations and multilateral lenders.
When the 2011 Arab Spring uprisings broke out in Libya, Egypt and Tunisia, Bouteflika spent heavily to ease protests in Algiers and elsewhere.
Demonstrations are still common, but are usually local and swiftly resolved with a visit by officials. Two people were killed in clashes over housing and living conditions in the south in November.
Since 78-year-old Bouteflika - president from 1999 and Algeria's longest-serving leader - suffered a stroke, questions have been raised about how far his government or the next may act on political and economic reforms.
Breakeven
Algeria may have ample FX reserves, but it still imports most of the goods it needs, including food, medicine and manufacturing parts.
Oil and gas exports reached $60 billion in 2014, down from $63.3 billion in 2013 and $72 billion the year before, while it faces a growing import bill that was close to $60 billion in 2014.
In its most recent report on Algeria last year, the International Monetary Fund estimated a breakeven oil price at $136 per barrel for 2014 - "one of the highest breakeven oil prices in the region among oil exporters".
The country - which has produced around 1.2 million barrels of crude a day for the last three years - is seeking to increase energy production, currently reliant on mature, less productive fields.
But in an auction last year, it awarded just four of 31 oil and gas field blocks on offer to foreign consortia in a second disappointing attempt since 2011 to draw investors.
Lower oil prices may further discourage foreign operators who already saw Algeria as a costly option due to its red tape and unfavourable contract terms. Algeria may also be more wary of quickly developing unconventional shale oil and gas in the face of recent environmental protests against "fracking" plans.
"We are working to accelerate tens of fields and we are studying increasing our production to make up revenues," Energy Minister Youcef Yousfi told state news agency APS.
"We really don't know how long this crisis will last."
(By Patrick Markey and Hamid Ould Ahmed; Editing by Pravin Char)