They met cute, at a funeral. As they buried Spain’s last dictator 40 years ago, stoic Madrid and flirty Barcelona forgot their centuries-old feud and threw themselves into each other’s arms.

That was then. The excitement of a democratic constitution granting Catalonia autonomy within Spain faded over the years, and the last decade’s brutal financial crisis left Barcelona as the household bill-payer, yearning for a divorce. Bitter grudges, once set aside, resurfaced.

As in so many failed marriages, the partners don’t speak the same language. Catalans have their own tongue, which is not merely a dialect of Spanish. And they resent what they view as linguistic imperialism from Madrid, even though the constitution of 1978 granted Catalan equal status on its own turf.

And Catalonia has recalled its old love, its left-wing heritage in Spain’s horrific civil war (1936-39). The current Madrid government bears no blame for yesteryear’s atrocities — Madrid suffered worse than did Barcelona as Francisco Franco’s fascists strangled the strife-torn republic. But emotions, not facts, rule decaying relationships.

Catalan nationalists play off a history of oppression. In the Middle Ages, Catalonia belonged to the kingdom of Aragon but was ruled directly by its own count, a homeboy. The trouble began with the marriage of Ferdinand of Aragon with Isabella of Castile (the queen who funded Columbus), after which Catalonia began to lose its traditional freedoms.

Catalans spent much of the next 500 years in rebellion or siding with the French against the Spanish court. Rebellions in the 17th and early 18th centuries ended the last vestiges of Catalan self-rule — and the Catalan language was banned from public use. In the 19th century’s Carlist Wars, Barcelona lined up against Madrid.

Catalonia’s dream of independence has deep roots.

Last week, the confrontation worsened fatefully. Insisting that Spain’s constitution does not permit secession, the central government sent in the national police. There were almost a thousand arrests and beatings as Madrid tried unsuccessfully to block an independence referendum. Now both sides glower and threaten and wait for the other’s next move.

Meanwhile, Catalonia, with its tourist-occupied capital, Barcelona, has barely 16 percent of Spain’s population, but accounts for 20 percent of GDP and a larger share of profitable exports. Catalans resent paying for Spain’s poorer provinces. Nationalism and greed are a volatile mixture.

For Madrid, though, it’s not just the money. Prime Minister Mariano Rajoy and his backers (including the figurehead king) worry that, should Catalonia succeed in breaking away, the Basque region might be next. And Valencia, where a dialect of Catalan is spoken, might seek to unite with Catalonia. The Balearic Islands are culturally closer to Catalonia, too. And at the other end of the country, Galicia could go. Spain would be reduced to little more than its late-medieval core, downgraded to a minor player in Europe.

The moment of truth is here, with firebrand Catalan political leader Carlos Puigdemont threatening to declare independence at any moment, while the central government warns of arrests, sedition trials and all necessary measures to keep Spain intact. Last week, Catalan police refused to obey Madrid’s orders as the “imported” police cracked down. Next time, they might fight back. (For a wry account of Barcelona’s last bout of major street fighting, read George Orwell’s “Homage to Catalonia.”)

If suppressed by force, the independence movement all but guarantees follow-on terrorism — with Basque bombings and assassinations finally in abeyance, Madrid has to dread renewed political violence.

In short, this is a mess.

Why should it matter to us? Because a strong and peaceful European Union is indisputably in our national interests, despite our petty squabbles. In the last century, Americans twice had to go to Europe and give blood in large amounts. The EU in good health means we don’t have to go again. But the EU is worried.

The concerns in Brussels are twofold: a bureaucratic dread of all disorder and, more seriously, the impetus a Catalan secession would give to other breakaway movements. The EU is splendid at regulating the fat content of cheese but has no mechanism to influence political upheavals. It’s structured to deal with trade, not human passions.

Brussels has made its preference known: It wants Spain to remain whole and refuses even to contemplate the Catalan side of the argument. And to be fair, not all residents of Catalonia want to leave Spain, although an unfettered referendum — without intimidation from either side — probably would vote for independence. But the Catalan drive has to be seen in historical context. For almost a hundred years, we witnessed the collapse of Europe’s empires, ending with the Soviet Union’s crack-up. That long process left behind a number of polyglot states, populations that view themselves as separate peoples and often speak different tongues.

The Yugoslav disaster was a worst-case example of what can result, with the peaceful partition of the former Czechoslovakia an ideal version, but tensions remain even in less-brutalized states. In Belgium, Flemish-speakers in the prosperous north don’t want to keep sending welfare checks to the French-speaking Walloons in the hardscrabble south. In Italy, wealthy northerners despise poorer Italians from the Mezzogiorno. Corsicans snarl about independence from France.

And Scottish nationalists chafe at Brexit, desiring to remain in the EU. Which highlights a paradox: As potential breakaway regions threaten to make states smaller, none of these independence movements want to leave the overarching, super-state EU.

“Small is beautiful” doesn’t apply to profitable trade, open internal borders and German bail-outs of profligate bad boys sunning themselves along the Mediterranean. Brussels may grimace at Barcelona, but the Catalans want their independent state to stay in the EU.

Of course, the one major world leader who loves all this upheaval is Vladimir Putin, who views the EU as NATO’s Siamese twin and will do all he can to damage it, from interfering in elections to quietly funding left-wing separatists and hard-line nationalists alike.

For us, an ocean away, it’s all too easy to shrug off the Catalan crisis as a problem for the next neighborhood over. But while presidents and prime ministers come and go, the post-1945 trans-Atlantic relationship — military, economic and diplomatic — has been the greatest success in the history of alliances. It’s given Europe the longest stretch of peace in the continent’s history. Together, we defeated the Soviet Union, truly an evil empire. Together, we’ve grown phenomenally prosperous.

Only a damned fool would want to see that stability end. To that end, President Trump has stated his preference for Madrid’s position. But that may only have strengthened Barcelona’s separatists: Our president is not admired across the water.

In the wake of Saturday’s peaceful mass demonstrations and counterdemonstrations, Catalan leaders still insist they will declare independence. Madrid would be compelled to respond. And violence would favor demagogues.

This is going to be either a very ugly divorce — or an abusive marriage that drags on in mutual anger.

Ralph Peters is Fox News’ ­strategic analyst and the author of the recent book “Judgment at Appomattox.”