The suspension of Parliament by Prime Minister Boris Johnson has been ruled as unlawful in the highest appeal court in Edinburgh.
A group of around 70 parliamentarians had appealed against a ruling by a judge at the court that Boris Johnson's prorogation of Parliament is lawful.
Judge Lord Doherty originally dismissed a challenge against the suspension at the Court of Session last Wednesday, saying it is for politicians and not the courts to decide.
But three judges of the Inner House, the supreme civil court in Scotland, disagreed with Lord Doherty's ruling.
A summary of the court opinion, published by the Scottish Courts and Tribunals Service, states: "The Inner House of the Court of Session has ruled that the Prime Minister's advice to HM the Queen that the United Kingdom Parliament should be prorogued from a day between 9 and 12 September until 14 October was unlawful because it had the purpose of stymying Parliament."
It continues: "All three First Division judges have decided that the PM's advice to the HM the Queen is justiciable, that it was motivated by the improper purpose of stymying Parliament and that it, and what has followed from it, is unlawful."
It went on: "The Court will accordingly make an Order declaring that the Prime Minister's advice to HM the Queen and the prorogation which followed thereon was unlawful and is thus null and of no effect."
The ruling comes a day after the prorogation took place in the early hours of Tuesday, with Parliament now suspended for five weeks.
At the appeal hearing on Friday Aidan O'Neill QC, representing the parliamentarians, claimed prorogation was unlawful in his closing arguments.
He said: "A decision to prorogue shuts down Parliament. It is in those circumstances an attack on democracy.
"It is an attack on the balance of the constitution and therefore is is unlawful."
David Johnston QC, representing the UK Government, had argued it was not for the courts to get involved in what was a political decision.
At the hearing, Judge Lord Carloway told the court: "We are of the opinion that the advice given by the Government to her majesty the Queen to prorogue parliament was unlawful and that the prorogation itself was unlawful."
He referred the matter to the UK Supreme Court for resolution.
Campaigners said their understanding is that Parliament can now reassemble if it so wishes.
The UK Government said it would appeal against the court's decision. A spokesman said: “We are disappointed by today’s decision, and will appeal to the UK Supreme Court. The UK Government needs to bring forward a strong domestic legislative agenda. Proroguing Parliament is the legal and necessary way of delivering this.”
SNP MP Joanna Cherry QC, who was among the cross-party group of politicians that brought the action, tweeted: "All 3 judges in Scotland's Highest court of appeal rule #Prorogation #unlawful! #Cherrycase succeeds.
"Huge thanks to all our supporters & our fantastic legal team who have achieved the historic ruling that #prorogation is #unlawful #Cherrycase #Brexit."
Read more: Labour will be punished by northern voters if it backs staying in the EU, says outgoing MP John Mann
SNP Westminster leader Ian Blackford tweeted: "This is great news, congratulations to you and all involved. This battle has further to run but my message to @BorisJohnson is you are playing fast and loose with the law. You have acted in an anti democratic manner and need to respond by recalling Parliament."
Liberal Democrats MP Luciana Berger tweeted: "As one of the Petitioners to this case, this is such an important ruling - although how awful that it's had to come to this."