Media playback is unsupported on your device Media caption Nicola Sturgeon has pledged to do all she can to protect Scotland's place in Europe

The Scottish government will seek to oppose the UK government in the Supreme Court during the appeal over the triggering of Article 50.

The High Court ruled last week that MPs must vote on whether the UK can start the process of leaving the EU.

The UK government immediately said it would appeal to the Supreme Court, with a hearing due next month.

The Lord Advocate, Scotland's most senior law officer, will now apply to be heard in the case.

A spokesman for Downing Street said it would be for the courts to decide whether the intervention was granted, but insisted it would "work very closely with all of the devolved administrations as we develop our plans for negotiating our exit from the EU."

Prime Minister Theresa May argues that the result of the EU referendum - and existing ministerial powers - means MPs do not need to vote on the triggering of Article 50.

But a panel of three High Court judges agreed with campaigners that the move would be unconstitutional, and that parliament would need to vote before the formal process of leaving the EU can begin.

Scotland's first minister, Nicola Sturgeon, believes that the consent of the Scottish Parliament and the UK's other devolved parliaments and assemblies should also be sought before Article 50 is triggered.

The Scottish government had legal representatives observing the High Court case, and later said it was considering whether to become directly involved when the appeal is heard.

Confirming that it would seek to intervene, Ms Sturgeon said she believed Scotland should be treated as an "equal partner" in the United Kingdom.

If the Supreme Court was to allow the Scottish government's intervention and ruled against the UK government, it could mean there would have to be a vote on Article 50 in Holyrood as well as in Westminster.

Image copyright EPA Image caption The High Court case against the UK government was brought by investment manager Gina Miller

Image copyright PA Image caption Lord Advocate James Wolffe QC will lodge a formal application at the Supreme Court to intervene in the case when the appeal hearing begins

The Welsh government has also said it will seek a role in the Brexit appeal case, while the Northern Ireland Attorney General has told a court in Belfast that one of two legal challenges to Brexit should be fast-tracked directly to the Supreme Court.

Ms Sturgeon stressed that she was not attempting to veto the process of England and Wales leaving the EU.

But she said the "democratic wishes of the people of Scotland and the national parliament of Scotland cannot be brushed aside as if they do not matter".

Voters taking part in June's referendum were asked the question: "Should the United Kingdom remain a member of the European Union or leave the European Union?"

In the UK as a whole the leave campaign won by 52% to 48%, but voters going to the polls in Scotland decided by 62% to 38% to remain in the EU.

Ms Sturgeon has pledged to do all she can to protect Scotland's place in Europe, and to maintain its membership of the single market.

Analysis

By BBC assistant political editor Norman Smith

As if Theresa May didn't have enough on her plate following last week's High Court ruling forcing the government to give MPs a say before Brexit is triggered, now the Scottish government has piled in.

In effect it has said if MPs are going to be given a say, the Scottish Parliament should also have to give its approval.

The difficulty for Mrs May is that she knows the Scottish Parliament is overwhelmingly opposed to Brexit and her fear will be that Nicola Sturgeon is in effect threatening to blow Brexit out of the water.

Scotland's first minister insists she is not playing the veto card. She respects the right of the rest of the UK to leave the EU, but wants to protect the interests of Scotland which voted against Brexit.

It may be she is simply trying to increase her leverage over Theresa May to try and secure a particular Brexit deal for Scotland - something Mrs May has already ruled out.

But there is another problem and it is on delay - the danger that Brexit gets snarled up in the courts.

We have already had the High Court ruling - the Supreme Court will decide on the appeal in January - and now Scottish lawyers are piling in and the danger is the timetable of triggering Brexit by March gets put through the legal shredder.

The first minister said: "The Scottish government is clear that triggering Article 50 will directly affect devolved interests and rights in Scotland.

"And triggering Article 50 will inevitably deprive Scottish people and Scottish businesses of rights and freedoms which they currently enjoy.

"It simply cannot be right that those rights can be removed by the UK government on the say-so of a prime minister without parliamentary debate, scrutiny or consent."

She also urged the prime minister to "live up to her promise to treat Scotland as an equal partner in the United Kingdom and listen to the will of the people of Scotland".

Image copyright Scottish Parliament Image caption The Scottish government believes Holyrood needs to give its consent before Article 50 is triggered

Answering questions from journalists, the first minister was pressed on the basis on which the Scottish government will seek to involve itself in the case.

She said: "If there is a need for legislation in the House of Commons that raises the question of legislative consent, not just in the Scottish Parliament but in Wales and Northern Ireland as well.

"If that is going to be an issue that the court is looking at... then it is absolutely right that the Scottish government is formally represented to make sure that the views that we would take around these processes are heard by the court."

The first minister said she would not go into the detail of what the Lord Advocate will argue, but made it clear she personally believes the UK government should seek approval for triggering Article 50 through a legislative consent motion at Holyrood.

She also said she believes there are those both in the Welsh and Northern Irish governments who would take a similar view about their own parliaments.

'Unjust and undemocratic'

Ms Sturgeon is due to unveil proposals for a "flexible Brexit" - which would see Scotland remain in the single market even if the rest of the UK leaves - in the coming weeks.

The Supreme Court has set aside four days, from 5 until 8 December, for the appeal hearing, which will see all 11 Supreme Court justices sit on the panel.

Judgment will be reserved at the conclusion of that hearing and follow at a later date, probably in the new year.

All five parties in the Scottish Parliament backed remaining in the EU ahead of the referendum, but the Scottish Conservatives, Labour and Liberal Democrats have warned Ms Sturgeon against using the result to push for a second vote on Scottish independence.

Scottish Labour said it supported the objective of getting the "best possible deal for Scotland", which it said meant "remaining part of the UK and retaining a close

Scottish Greens MSP Ross Greer said it was "reasonable that MSPs who represent the people of Scotland are consulted before any steps are taken to remove us from Europe against our wishes."

And Scottish Lib Dem leader Willie Rennie called on the prime minister to "end all this and simply accept that there must be a democratic vote before Article 50 is invoked".