A German court has ruled that former Catalan leader Carles Puigdemont can be released on bail pending a decision on his extradition to Spain.
Judges found the most serious accusation against him is not punishable under German law.
The state court in the northern town of Schleswig said it set conditions including a 75,000-euro payment for the 55-year-old to leave prison.
It was not immediately clear when he would be released, though it appeared unlikely before Friday morning.
“We will see each other tomorrow. Thank you all!” a message posted on his Twitter feed read.
Mr Puigdemont was detained on a European arrest warrant shortly after entering Germany on March 25.
He was trying to drive from Finland to Belgium, where has been living since fleeing to escape arrest in Spain. He has been held at a prison in Neumuenster.
Spanish authorities accuse Mr Puigdemont of rebellion and misuse of public funds in organising an unauthorised referendum last year on Catalonia’s independence from Spain.
German prosecutors argued earlier this week that the main charge of rebellion is equivalent to Germany’s criminal offence of treason.
German law calls for prison sentences for anyone who “undertakes, by force or through threat of force” to undermine the republic’s existence or change its constitutional order.
However, the court disagreed on Thursday, saying Mr Puigdemont cannot be extradited for rebellion.
It found that the accusations against Mr Puigdemont do not satisfy the precedents set by previous German rulings, which call for a use or threat of force sufficient to bend the will of authorities.
“That is not the case here,” the court said in a statement.
Judges will consider Mr Puigdemont’s extradition on the less serious charge of misusing public funds, meaning that he only could face trial for that if he were returned to Spain.
They said that there was no indication he could be “exposed to the danger of political persecution”.
The court said that because Mr Puigdemont cannot extradited for rebellion he posed less of a flight risk and could be released on bail.
If Mr Puigdemont makes the bail payment and leaves prison, he cannot leave Germany without prosecutors’ approval, must inform prosecutors of every change of residence and report to police once a week, court spokeswoman Frauke Holmer said.
In response to the German court’s ruling, a Spanish official said the government in Madrid respects judicial decisions “always, when it likes them and when it doesn’t”.
The official said: “Spanish justice will adopt the appropriate measures in the face of these new circumstances.”
Mr Puigdemont’s Spain-based lawyer welcomed the court’s decision.
“I always said that I had full confidence in the German judiciary,” Jaume Alonso-Cuevillas wrote on Twitter, adding: “We continue.”