Spain’s effort to snuff out an independence drive in Catalonia was dealt a significant blow on Thursday as secessionists narrowly won an election called by Prime Minister Mariano Rajoy in hopes of calming the country’s constitutional crisis.
After Catalonia’s separatist lawmakers declared independence in late October, Mr. Rajoy invoked emergency powers for the first time in Spain’s democratic history. He ousted the Catalan government and imposed direct rule on the formerly autonomous region.
Mr. Rajoy then called new elections for the regional parliament, hoping to reshuffle the political deck and calculating that Catalan voters would punish the secessionist leaders. Many are now being prosecuted for sedition and rebellion and campaigned from prison or exile.
That gamble did not pay off. Official results showed Catalonia’s separatist parties once again winning a narrow majority in the region’s parliament — as they had before — an outcome that could allow them to revive their independence drive.
After months of feuding, Mr. Rajoy, Catalonia and indeed all of Spain ended up close to where the crisis had started.
The standoff is now certain to enter a new, equally contentious phase. It has already unsettled not only Spain but also its neighbors in the European Union, many of whom are fearful of separatist challenges of their own at a time of rising populism and nationalism. Almost no politician outside of Catalonia has supported the drive for independence.
But this time Mr. Rajoy will be politically weakened, even at a national level, after having lost his bet that a sufficiently large majority of Catalans would rally behind his call for Spanish unity to block the secessionist challenge.
“This result does nothing to solve the conflict but instead reinforces the extremists on both sides,” said Elisenda Malaret Garcia, a professor of administrative law at the University of Barcelona.
The election campaign has now helped harden positions on all sides — between the central government in Madrid and the separatist leadership, as well as between unionists and separatists in Catalonia.
The prosperous northeastern region, which includes Barcelona, the hub of Spain’s thriving tourism sector, has harbored desires for independence based on its distinct language and culture for generations.
But even in Catalonia, the results reflected painful divisions, with the separatist parties squeaking out a majority of seats — narrower even than the fragile one they held before.
The three main separatist parties won 70 of the 135 seats in the Catalan Parliament, official results showed. Over all, the separatists won only about 47 percent of the votes, according to the preliminary results, but they benefited from a voting system that favors their dominance in rural areas.
Their victory by no means assures success. The separatists are a fractious group, and they have already struggled in the past to agree on tactics and strategy. In recent weeks, their disagreements have become more profound, after their failed independence push in October.
The separatist parties may now find themselves facing a difficult round of negotiations to decide who should lead Catalonia’s government and how to put their secessionist project back on track.
The leaders of the two main separatist parties campaigned from outside Catalonia — one from prison in Madrid and the other from a self-imposed exile in Belgium — and both face prosecution for rebellion after a botched attempt to flout Spain’s Constitution and declare unilateral independence.
Yet their sense of vindication at the outcome was undisguised.
Speaking from Brussels around midnight, Carles Puigdemont, the former leader of Catalonia who was removed by Mr. Rajoy, said Thursday’s record turnout of about 83 percent had produced “an indisputable result” in favor of the separatists.
“The Catalan republic has won,” he said, while “Rajoy and his allies have received a slap in the face from Catalans.” Mr. Puigdemont said Spain’s prime minister “must change his recipe rapidly if he wants us to find solutions.”
Mr. Puigdemont also called on Mr. Rajoy to remove his direct control over Catalonia “tomorrow” and argued that the jailed Catalan separatist leaders “cannot stay one minute longer in prison” after Thursday’s result.
He did not say, however, whether he would return to Spain soon to seek to start a new mandate as leader of Catalonia.
Mr. Puigdemont surfaced almost two months ago in Belgium, and he has refused to return to Spain be prosecuted for rebellion. Oriol Junqueras, the leader of the other main separatist party, Esquerra Republicana, awaits trial in a prison in Madrid.
Mr. Puigdemont’s party won 34 seats in the next regional parliament, two more seats than its rival separatist party.
“The Spanish government will no longer be able to ignore the fact that a majority of Catalans have rejected Mr. Rajoy’s intervention in Catalonia and want an independence referendum,” said Carles Campuzano, a lawmaker from Mr. Puigdemont’s party.
Mr. Rajoy’s Popular Party earned just three seats and ended up last among the main unionist parties. It was the biggest loser of the night.
Instead, most unionist votes went to Ciudadanos, a rival party on which Mr. Rajoy already depends to keep his minority government alive in Madrid. The advance of Ciudadanos will make it the largest party in the next Catalan Parliament.
Inés Arrimadas, the leading candidate of Ciudadanos, said her party’s win, coupled with the slight weakening in support for the separatist parties, confirmed that the independence movement “doesn’t represent a future for all Catalans.”
“The nationalist parties can never again speak in the name of all Catalans,” she added.
Analysts saw potential losers and pitfalls all around, however, given the narrowness of the separatist victory and the political gulf it indicated in both Catalonia and the country.
The election outcome was “another unwanted result of years of inaction” by Mr. Rajoy in Catalonia, said Jordi Sevilla, a former Socialist minister.
Mr. Sevilla forecast that Catalonia could require another election because of infighting among the separatist parties, while Mr. Rajoy would be forced into an early national election following his failure to solve the Catalan conflict.