Image copyright EPA Image caption Prof Pansati was greeted by supporters when she emerged from the court on Wednesday afternoon

A pro-independence Catalan politician who is being sought by the Spanish government has been released on bail by a Scottish court.

Prof Clara Ponsati was formally arrested after arriving voluntarily at an Edinburgh police station.

She later appeared from custody at an initial extradition hearing at the city's sheriff court.

Bail was not opposed, and she will now embark on a legal fight against being returned to face trial in Spain.

Prof Ponsati, who says the charges against her are politically-motivated, was asked to surrender her passport.

The authorities in Madrid issued a European Arrest Warrant after accusing her of rebellion - defined under Spanish law as being involved in a violent uprising - and misappropriation of public funds.

The allegations relate to her involvement in organising last year's Catalan independence referendum, which was ruled illegal by the Spanish courts.

Former Catalan leader Carles Puigdemont, who faces similar charges, was taken into custody in Germany at the weekend.

Media playback is unsupported on your device Media caption Prof Ponsati's lawyer read out a statement when she arrived to hand herself in to police earlier in the day

The hearing before Sheriff Nigel Ross lasted less than 10 minutes, with a number of Prof Ponsati's supporters present in the packed court room and many more gathered outside.

Among them were several prominent SNP politicians, including former Holyrood presiding officer Tricia Marwick.

Ms Marwick told BBC Scotland that it would be "impossible for Clara, and indeed for any of the other political prisoners" to have a fair trial in Spain as there was "absolutely no separation between the justiciary and the government".

'Grotesque distortion'

Speaking outside court, Prof Ponsati's lawyer Aamer Anwar said his client was opposing the extradition warrant from the Spanish Supreme Court and would "robustly deny the charges" against her.

He added: "The 52-page warrant included the crimes of rebellion - punishable by up to 25 years in prison - as well as the crime of misappropriation of public funds, punishable with up to eight years' imprisonment.

"Clara wishes for me to state that these charges are politically motivated and a grotesque distortion of the truth. She cannot believe that she is being held responsible for the violence that took place on the day of the referendum."

Image copyright Reuters Image caption The former Catalan education minister was formally arrested when she entered St Leonard's police station in Edinburgh

Mr Anwar said Prof Ponsati believes that the Catalan people "tried to express a democratic right to decide their own destiny" during the referendum.

And he said the only people that should be held responsible for the "brutal violence" was the Spanish police and state security forces who "attacked the Catalan people on behalf of the Spanish government".

He added: "She submits that Spain has not followed due process, cannot guarantee the independence of the judiciary and has repeatedly abused the human rights of the Catalan people."

Prof Ponsati turned herself in to officers at St Leonard's police station on Wednesday morning, before being taken to court.

She has thanked First Minister Nicola Sturgeon, the Scottish government and other Scottish politicians for their "solidarity", with Mr Anwar saying Prof Ponsati believes "Scotland has been a true friend to Catalonia in her darkest hours".

An online crowdfunding appeal to pay Prof Ponsati's legal costs had raised about £170,000 by 16:00 on Wednesday. Her initial target was £40,000, but this was later increased to £200,000.

Who is Clara Ponsati?

Image copyright Reuters Image caption She fled to Brussels with Carles Puigdemont following the Catalan referendum

Prof Ponsati had been working as the director of the School of Economics and Finance at the University of St Andrews since January 2016, before being appointed as the Catalan government's education minister in July of last year.

She returned to work at St Andrews earlier this month, having been in Belgium since fleeing Spain with Catalonia's ex-leader Carles Puigdemont and three other former cabinet members following an unsuccessful bid to declare independence from Spain in October.

A Spanish judge issued arrest warrants on Friday for Prof Ponsati and the other fugitive politicians, including Mr Puigdemont, who was detained by police in Germany.

How likely is it that she will be extradited?

In almost all cases, there is a requirement that the allegations would amount to a criminal offence were it to have occurred in the UK.

Prof Ponsati's legal team could argue that rebellion is not a specific criminal offence in Scotland - although there is a crime of treason, which covers disloyalty to the Crown.

The extradition request could also be defeated if Prof Ponsati successfully argues that it is politically-motivated.

But extradition lawyer Karen Todner told BBC Scotland it is rare for European requests to be refused for this reason, because "as part of the European Union we are supposed to believe that all requests are fair and proper".

Regardless, the legal process is likely to take several months and could be challenged all the way to the High Court.

Image copyright Getty Images Image caption Supporters gathered outside the court ahead of Prof Ponsati's hearing

What does the Scottish government say?

Scotland's independence movement has close links to its Catalan counterpart, and the SNP is overwhelmingly supportive of Prof Ponsati's cause.

But First Minister Nicola Sturgeon, who is also the SNP leader, has not explicitly backed Catalan independence and has stressed that her Scottish government cannot intervene in the legal process.

Ms Sturgeon has repeatedly said she supports the right of the Catalan people to determine their own future, and has criticised the Spanish government's decision to arrest and imprison pro-independence Catalan politicians.

She added: "The fact that our justice system is legally obliged to follow due process in the determination of extradition requests does not change those views."

The SNP's leader at Westminster, Ian Blackford, has requested a meeting with the Spanish ambassador in London to express the party's concern over the treatment of Prof Ponsati and other Catalan politicians.