Rising prices, a collapsing currency, international turbulence, and a nervous elite. Azerbaijan is starting 2016 in the middle of what looks like a perfect storm.

Street demonstrations in a dozen towns in different parts of the country in protest at the sudden economic downturn have been met with a show of force and arrests. Video footage on non-official television shows scenes that are depressingly familiar from Tunisia to Tajikistan: riot police on the streets of a town confronting crowds of angry young men with water cannon and tear gas.

To make matters worse for the government, this began a week ago, even before sanctions on Iran were lifted and the oil price fell below $30 a barrel. (Around three quarters of Azerbaijan’s budget revenues come from oil sales.)

It is a foretaste of the trouble that Russia may soon face for very similar reasons. The public, it seems, can forgive an authoritarian government almost anything except a falling standard of living. On January 18, President Ilham Aliyev announced a package of emergency measures that included currency controls and selling off state assets. This all follows the Azerbaijani Central Bank's decision to allow the currency, the manat, to fall dramatically for the second time in 2015, after spending $8 billion trying to support it—and despite repeated declarations, right until the eve of the devaluation, that the currency was “stable.”

It was a rude shock. On New Year’s Day in 2015, one dollar bought you 0.78 manats. Now, it will officially buy you almost 1.60 manats—and unofficially more than that. Long queues have formed to exchange foreign currency at banks.

The currency collapse has hurt Azerbaijan’s middle class, who have taken out dollar-denominated loans and come to rely on imported goods.

It has also hit the population at large outside the capital Baku, who saw prices on staples, such as flour, shoot up. One Azerbaijani economist warns of the risk of the massive inflation experienced recently by Ukraine, the only post-Soviet country which has experienced a comparable currency crash.

At what point do economic protests become political? It is a blurry line.

Many Azerbaijanis certainly feel angry at the way the billions the country has earned in the last decade have disappeared into vanity projects like the European Games or into offshore bank accounts.

For years, Azerbaijani politics has been glacially quiet. President Ilham Aliyev has obliterated the formal opposition. Over the past two years, he has had leading critics of his regime—human rights defenders, journalists, and youth activists—arrested.

But that is deceptive. Only 20 years ago, Azerbaijan had a turbulent and chaotic political life, which was put to an end by the skills of the all-powerful Heidar Aliyev.

Ilham Aliyev, Heidar's son and successor since 2003, has never been the dominant monarch that his father was, more of the pivot at the center of the elite, the “first amongst equals,” and arbiter of disputes amongst top officials, who are also rent-seeking businessmen.

Cracks are now appearing in this structure. In October, Eldar Mahmudov, Azerbaijan's long-serving national security minister—the head of what used to be the KGB—was sacked, along with most of his subordinates. There are many rumors as to why. One tells of a conspiracy with the former head of the International Bank of Azerbaijan—a relative by marriage of Mahmudov—to defraud the government. Or else, reportedly, Mahmudov was caught carrying out secret surveillance of fellow ministers and presidential officials.

It seems likely that Mahmudov will be charged before too long. The pro-government media has already put together a lurid charge-sheet against him, alleging that police discovered 30 boxes of dollar bills and glass jars of diamonds and that he had bought his son an eight-room apartment in central London worth £30 million.

Yet this is dangerous territory as it only draws attention to all-too-plausible reports in the pro-opposition media that higher-profile ministers and members of the presidential inner circle have defrauded the Azerbaijani state of even bigger sums.

Trouble at home comes within a worsening international context. Azerbaijan is in the middle of a (self-inflicted) row with the United States, after closing down almost all U.S. organizations in Baku and accusing Washington of fomenting a “color revolution” in the country. A bill threatening sanctions in response to human rights abuses was recently tabled in Congress.

The row between Russia and Turkey, its two closest international partners, has put Azerbaijan in an awkward spot. (Only last year, Aliev was convening a friendly meeting between Putin and Erdoğan in Baku.)

Lifting of sanctions on Iran is a triple blow. It removes a major card Baku was playing with the West (that it was a bulwark against a hostile Iran), reinvigorates a regional power which has a number of quarrels with Azerbaijan, and depresses oil prices. Moreover, there is talk in Georgia of importing oil from Iran via Armenia, which would end Azerbaijan's monopoly on gas imports.

There are two wild cards here. One is the unresolved conflict with Armenia over Nagorny Karabakh. Over the last few years, the ceasefire regime established in 1994 has deteriorated, Azerbaijan has acquired a fearsome new arsenal of weaponry, and the country has turned up the dial of bellicose rhetoric against the Armenians for occupying Azerbaijani land.

The increasing worry is that an Azerbaijani regime that is in desperate straits might choose to “play the Karabakh card”—-the one grievance that can rally all Azerbaijanis around the flag—and start a military operation, large or small, to recover lost territory. In that case, the Armenians would be bound to strike back and a new and potentially catastrophic conflict in the Caucasus would break out.

The other wild card is political Islam. For understandable reasons, Azerbaijan’s secular pro-Western political prisoners have captured most of the attention abroad. (On December 28, one of the most prominent of them, well-known journalist Rauf Mirkadirov, was given a six-year jail sentence on the absurd charge of spying for Armenia.)

But the majority of the prisoners are Muslims accused of political radicalism, whether they be Shias from the pro-Iranian village of Nardaran or Sunnis accused of sympathy for the so-called Islamic State. The level of support for political Islam is hard to judge because it is below the surface. We can only be certain that, as in much of the Middle East, the more it is suppressed the stronger its appeal will be.

Last year, the Azerbaijani government predicated its budget forecasts on $50-a-barrel oil. Now, President Aliyev faces the near-impossible task of how to buy off very different groups of discontented citizens with oil at little more than half that level.