A German court has rejected "rebellion" as grounds to extradite Catalonia's ex-leader Carles Puigdemont and ordered his release on bail.
The Schleswig-Holstein court said he could still face corruption charges in Spain, and it has only suspended extradition - not ruled it out.
He was arrested in the north German region last month, after Spain issued a European Arrest Warrant.
Spain charged top Catalan separatists over October's independence referendum.
The court has been considering what to do about a Spanish extradition request for Mr Puigdemont for more than a week.
Mr Puigdemont faces charges of sedition, rebellion and misappropriation of public funds in Spain as a result of his role in last year's Catalan banned independence referendum.
He was detained on 25 March while crossing into Germany from Denmark on his way to Belgium, where he has been living in self-imposed exile since Catalonia's parliament unilaterally declared independence from Spain in October.
Spain has accused the former Catalan president of rebellion, but the court concluded that the closest equivalent to this in German law was high treason.
But it ruled that in Mr Puigdemont's case there was no element of violence, so the charge was inadmissible.
However, the court in the northern city of Schleswig said there could be a case to answer for misusing public funds last October to hold an unauthorised independence referendum.
It has asked for further information on these charges and set bail at 75,000 euros (£65,000; $90,000).
The president of the Catalan parliament Roger Torrent described Mr Puigdemont's conditional release as "very good news" on Twitter.
"We always said that we were not violent. The charge of rebellion is totally invalid. This political persecution has to end it is as it is driven by completely false narrative." Mr Torrent said.
The Spanish government said it respected the decision of the German court.
"The government never gives an opinion on court decisions, especially when it concerns court decisions made in another country. It always respects them, whether it likes them or not," a government spokeswoman said.