Supporters of Catalan independence celebrate at the Catalan National Assembly headquarters after receiving results of the regional elections Thursday in Barcelona. (Emilio Morenatti/AP)

Catalonia’s pro-independence parties won a major victory Thursday: Together, they secured a five-seat majority over all other parties in the Catalan Parliament. Separatists were triumphant about their victory.

But here’s the problem: The separatist victory is a manufactured product of Catalonia’s electoral system, in which voters cast their ballots for a single party list and seats are awarded to parties proportionally using the d’Hondt formula within each of Catalonia’s four provinces.

As I’ve explained before, this system is stacked in favor of the separatists — which is how the three pro-independence parties won a parliamentary majority while receiving just 47.7 percent of the vote. Three factors skewed the results.

First, Catalonia gives the three more rural provinces, where separatist parties do well, 15 more of the 135 total deputies than they merit based on population. Conversely, Barcelona, the most unionist province, is underrepresented.

This is known as “malapportionment.” Had Catalonia allotted seats fairly among the provinces, pro-independence parties would have fallen one seat short of a majority.

Second, separatist parties benefit from the tendency of districts with fewer seats to give a bonus to stronger parties. The disproportionality between the share of votes and seats won by a party increases as the number of seats declines.

In a district with just one seat — like in the U.S. House — it’s possible to win with just 51 percent (or sometimes less) of the vote. The same thing is true even under proportional representation. In districts with just a few seats, you sometimes see similar disproportionality. In 2016, Spain’s governing People’s Party won two of the three seats in Cuenca province with just 46 percent of the vote.

Had Catalonia held its elections in a single, regionwide district, separatist parties would have won just 66 seats — two short of a majority.

Third, the d’Hondt formula used to allocate seats based on votes, while commonly used around the world, is biased in favor of larger parties. Another way of allocating seats, called the Ste. Laguë formula, is more proportional and not biased in favor of large or small parties.

In Thursday’s election, substituting Ste. Laguë for d’Hondt would have whittled the pro-independence majority from five seats down to one — even if all other aspects of the system, including malapportionment, had been retained.

Switching to the fairer Ste. Laguë formula and either eliminating malapportionment or electing the Parliament from a single district would have awarded parties opposed to the UDI a five-seat majority over pro-independence parties.

Electoral rules may seem like trivial details compared with the emotional debate over Catalonia’s status. But these rules matter a lot.

Thursday’s outcome in Catalonia gives pro-independence forces a psychological boost and allows them to claim a popular mandate — even though they received fewer votes than their opponents. The day after the election, separatist leader Carles Puigdemont claimed that the results showed that the desire for independence “is neither a fantasy nor a hologram” and demanded that Spanish Prime Minister Mariano Rajoy “accept the results of the ballot.”

Thursday’s outcome also allows pro-independence forces to govern Catalonia and press for independence despite losing the popular vote. The continued jockeying for position between the Catalan and Spanish governments will make it difficult to attain political and economic stability.

David Lublin is professor of government in the School of Public Affairs at American University and the author of “Minority Rules: Electoral Systems, Decentralization and Ethnoregional Party Success” (Oxford 2014).