The outcome of the Turkish constitutional referendum to expand President Erdoğan’s powers was a foregone conclusion from the moment it was announced. The results were nevertheless surprising because they showed how resilient the opposition in Turkish society is.

Turkey has been under an oppressive ‘state of emergency’ since 21 July 2016. Declared after the failed coup attempt on 15 July (and set to continue for the foreseeable future), it has given President Erdoğan nearly unlimited powers. Tens of thousands of people have been arrested and more than 100,000 sacked, including thousands of academics, judges, prosecutors and union activists. It is a good bet that anyone left in a civil service position in Turkey is either an Erdoğan crony or someone who knows how to keep their head down. The president has captured most state institutions which are supposed to be autonomous or free from political pressure, including the Electoral Board.

The people who have lost their jobs have also had their passports revoked. Private companies won’t employ them for fear of attracting the state’s attention. Many private businesses have been shut down and their holdings confiscated or transferred to the state, including more than a hundred media outlets. Hundreds of journalists are in prison, the highest number of any country in the world, and many are facing sentences of aggravated life imprisonment. Others are in exile.

In the south-east, where Kurds make up the majority of the population, elected mayors have been replaced by state-appointed trustees. The leaders of the pro-Kurdish opposition party, HDP (the third largest party in the parliament), have been in prison since November, stripped of their parliamentary immunity. In the months leading up to the referendum, the ‘mainstream’ opposition, too, was targeted by the state, with several No campaigners being detained on the flimsiest excuses. Even the most milquetoast opposition politicians got barely any screen time. Meanwhile, Erdoğan’s speeches are broadcast live, daily, repeatedly, on multiple channels. The ballot itself did not include any information on the constitutional changes, just a choice between Yes and No.

The idea that a proper referendum could be held under such conditions has always been a sham. The masquerade was easier to pull off because the West is too preoccupied by its own problems and troublemakers to pay much attention to what is happening in Turkey. This may be the reason that initial Western reactions to the result ran along a spectrum from ‘oh well’ to ‘Turkish democracy has died.’ The belated handwringing may occlude the most significant aspect of what was never intended to be more than an expensively produced charade: the bit players went off script, believing against all odds they were participating in a real vote.

Voting day was marked by irregularities. The Electoral Board announced that ballots missing the official ballot box stamps could be included in the vote tallies. A spokesman for the main opposition party, the CHP, has said they believe this allowed for over two million extra ballots – more than the difference between the Yes and No votes. The Electoral Board’s decision cannot be challenged in the courts because it was never officially issued.

There are other curiosities. Hayır ve Ötesi, an election watchdog NGO, has determined that 961 districts voted 100 per cent Yes, despite evidence of sizeable opposition blocks in those districts from previous election cycles. Other districts show every single registered voter showing up to cast a vote. A cursory review of some of the sign-in sheets show that the same person signed in for many different voters. In Kurdish-majority districts in the south-east, a striking proportion of previously anti-AKP voters seem to have decided to reward Erdoğan for the failure of the peace process and imprisonment of Kurdish politicians. The HDP says it has evidence of enough irregularities from the region to trigger a repeat vote (not that there’s any chance of that).

Given all this, it is remarkable that the best result the regime could produce was a split of 51 to 49 per cent. In his acceptance speech, Erdoğan referred to the result as a fait accompli. The arrests of protesters this week make clear that he is unlikely to loosen his grip on Turkish society. But he now knows, and we know, that he is no longer supported by a majority of Turks, despite all the grandstanding and the propaganda. And he has to face another election before the new powers kick in in 2019. No doubt he will try everything to recapture the magic with the masses. He has already promised referendums on reinstituting the death penalty and Turkey’s quest for EU membership. He may yet pull some aggressive foreign policy out of the hat.

But Sunday’s result suggest that the majority of Turkish citizens – especially the urban, educated population – are no longer buying his vision for the country. The distaste for Erdoğanism has spread beyond the traditional secular Kemalist bloc. There are many reasons to be gloomy about the prospects of Turkish democracy, but all of them predate the day of the referendum. What the vote has in fact revealed is a tiny crack of light.