Catalonia’s ousted separatist leader, Carles Puigdemont, has declared that the Spanish state has been defeated in a snap regional election.
Speaking in Brussels where he is in self-imposed exile, Mr Puigdemont hailed the result as a victory for the “Catalan republic”.
Separatist parties will hold a slim, reduced, majority in the new assembly.
However the Citizens party, which wants Catalonia to remain a semi-autonomous part of Spain, is the biggest party.
As a result, it is unclear who will be given the right to form a government.
The Spanish government imposed direct rule on Catalonia and called the election after declaring an October independence referendum illegal.
Prime Minister Mariano Rajoy had hoped the poll would restore stability but instead Spain’s political turmoil looks set to continue. Mr Rajoy’s conservative Popular Party (PP) recorded its worst ever result in Thursday’s vote.
“This is a result which no-one can dispute,” Mr Puigdemont said in a televised speech from Belgium.
“The republic of Catalonia has won… the Spanish state was defeated. Rajoy and his allies lost,” he told cheering supporters.
With nearly all votes counted, the pro-independence parties Together for Catalonia (JxCat), Republican Left of Catalonia (ERC) and Popular Unity (CUP) were on course to win a total of 70 seats in total, giving them a majority in the new parliament.
Citizens (Cs) had 25.3% of the vote, winning 37 seats in the 135-seat chamber.
Its leader Inés Arrimadas told the BBC her party had been “victorious”. She said forming a coalition would be “difficult – but we will try”.
The PP, meanwhile, won only three seats, down from 11 in the previous assembly.
Turnout was more than 80%, a record for a Catalan regional election.
Separatists who dominated the previous Catalan parliament declared independence on 27 October after a referendum that was declared illegal by Spain.
In an attempt to stop that referendum, Spanish police stormed some polling stations. However many voters defied the Spanish courts and riot police to cast their ballots.
The move led to violent clashes with hundreds of people reported injured.
According to referendum organisers, 90% of voters were in favour of independence, but fewer than half the region’s electorate took part.
However, Mr Puigdemont decided it was enough to declare independence from Spain.
Mr Rajoy then sacked the Catalan government, imposed direct rule and called the 21 December election.
Prosecutors accused 13 Catalan separatist politicians of rebellion and sedition, including Mr Puigdemont and four others who fled to Belgium.
Among the accused, two pro-independence politicians are in Spanish prisons, and six are being monitored while on bail.
The European Commission said that its stance towards Catalonia remained the same, despite Thursday’s election result.
The executive arm of the EU has previously stated that events in Catalonia are an internal issue for Spain.
“Our position on the question of Catalonia is well known and has been regularly restated, at all levels. It will not change,” commission spokesman Alexander Winterstein told AFP news agency.
“In relation to a regional election, we have no comment to make,” he added.
The Spanish government has not yet commented on the results.
Analysts say the success of separatist parties means that the ball is now back in the Spanish government’s court.
Antonio Barroso, of the London-based research firm Teneo Intelligence, says the problem for Madrid remains “and the secession movement is not going to go away”.
Correspondents say it is not yet clear whether Mr Puigdemont will be renamed president, and if so, if he will return from Belgium. As things stand, he faces arrest, should he enter Spain.
Catalonia is one of Spain’s wealthiest and most productive regions and has a distinct history dating back almost 1,000 years.
Before the Spanish Civil War it enjoyed broad autonomy but that was suppressed under General Francisco Franco’s dictatorship from 1939-75.
When Franco died, the region was granted autonomy again under the 1978 constitution, and the region prospered along with the rest of the new, democratic Spain.
A 2006 statute granted even greater powers, boosting Catalonia’s financial clout and describing it as a “nation”, but Spain’s Constitutional Court reversed much of this in 2010.
Recession and cuts in public spending fuelled local resentment, which coalesced in a powerful secessionist movement.
Following a trial referendum in November 2014, outlawed by Spain, separatists won the 2015 regional election and went on to win a full referendum on 1 October 2017, which was also banned and boycotted by unionists.