WHEN a democracy sends riot police to beat old ladies over the head with batons and stop them voting, something has gone badly wrong. Catalans say that almost 900 people were hurt by police in the referendum for independence on October 1st. Whatever the provocation from Catalan leaders in staging an unconstitutional poll, the reaction of Mariano Rajoy, the prime minister, has thrown Spain into its worst constitutional crisis since an attempted coup in 1981.

If Mr Rajoy thought that cracking heads would put a stop to secessionism, he could not have been more wrong. He has only created a stand-off that has energised his enemies and shocked his friends (see article). On October 3rd Catalonia, one of Spain’s richest regions, was paralysed by a protest strike. Hundreds of thousands of demonstrators have marched to express their outrage.

Secession would be a disaster for Spain. The country would lose its second city and risk the further loss of the Basque region. Secession would also hurt Catalans, which is why a majority of them probably oppose it. And Catalan independence might stir up separatism elsewhere in Europe—in Scotland again, no doubt, but also in northern Italy, in Corsica, perhaps even in Bavaria. To prevent the crisis deepening, both sides need to seek a new constitutional settlement. Instead, they are digging in and Catalonia is on the brink of unilaterally—and illegally—declaring independence.

After Franco

Spain has a historical fear of dismemberment. Catalan secessionism was one of the factors that brought about the Spanish civil war of the 1930s. Many Spaniards no doubt share the anger of King Felipe who, in a rare televised speech, denounced Catalonia’s leaders for irresponsibly and disloyally tearing up the constitution of 1978. After all, Catalans overwhelmingly endorsed that settlement, which entrenched democracy, brought prosperity and granted a large dose of autonomy to Spanish regions, including Catalonia.

A well-run democracy must abide by the rule of law. That is what protects democratic liberties, not least the freedom of minorities to express discontent. Until referendum day, nobody who experienced the vibrancy of Barcelona could seriously claim that Catalonia was oppressed. With few exceptions, notably when empires collapse, the world generally favours national unity over self-determination by subnational groups. Many of the states liberated by the break-up of the Soviet empire joined the European Union, but these days the EU is wary, warning would-be secessionists that new states have no automatic right to join. Without Spain’s support, Catalonia would find itself on the wrong side of a new customs wall.

For all these reasons the Catalan leader, Carles Puigdemont, does not have a strong case for independence. Nor can he claim a real mandate. He rammed the laws authorising the referendum through the Catalan parliament with a narrow majority and without proper debate. Those laws have no formal legal standing. Before his referendum, opinion polls suggested that only 40-45% of Catalans wanted to break away. The 90% vote to leave was 90% of an unregistered turnout of well under half, because Catalonia’s Remainers mostly declined to take part. As with populists elsewhere, Mr Puigdemont has offered a simplistic vision, without explaining the costs of independence or how it might come about.

But that is not the end of the story. Democracy rests on the consent of the governed. Even some who disagree with Mr Puigdemont’s methods believe Catalonia has a case for nationhood. It could survive economically. A lot of its people think it constitutes a nation. Under autonomy, Catalan leaders have promoted their language and their nationalist creed.

The pain in Spain

Whatever the legality of separatism, once the desire for independence reaches a critical point, governments must deal with it in three ways: crush it, bow to it, or negotiate in good faith, knowing that separation may still be the outcome.

Mr Rajoy has failed to grasp the nature of this choice. First he blocked the nationalists in the courts and, last weekend, he resorted to force. His deployment of policemen to suppress the Catalan vote was not only a propaganda gift to them but, more important, crossed a line. Aggression against crowds of peaceful citizens may work in Tibet but cannot be sustained in a Western democracy. In the contest between formal justice and natural justice, natural justice wins eventually every time. Constitutions exist to serve citizens, not the other way around. Rather than uphold the rule of law as he intended, Mr Rajoy ended up tarnishing the legitimacy of the Spanish state.

Will Mr Puigdemont declare independence? That would be reckless and irresponsible but, if he does, Mr Rajoy should resist the temptation to arrest Catalan leaders and, for the time being, avoid using his power to suspend regional rule. Just now, either measure would only compound his mistakes.

Only a negotiation can restore calm and it should start immediately. Even now most Catalans can probably still be won over with the offer of greater autonomy, including the power to raise and keep more of their own taxes, more protection for the Catalan language and some kind of recognition of the Catalans as a “nation”. Mr Rajoy might even take up the opposition Socialists’ idea of turning Spain into a federal state.

Any settlement, though, must include the option of a referendum on independence. Separation would be a wrenching change for Catalonia and the rest of Spain, so should not be done lightly. A majority of Catalans eligible to vote should be the minimum threshold for independence. A follow-up vote on the terms of a separation might be wise, too.

For all his deficiencies, David Cameron, the former British prime minister, was right about allowing a referendum on Scottish independence in 2014. He made the case for Scotland to stay, and won the vote convincingly. Mr Rajoy should do the same. The case for the unity of Spain is strong. But it must be won by force of argument. By using force alone, Mr Rajoy is not preventing the break-up of Spain, but hastening it.