LONDON (Reuters) - The British government launched a Supreme Court battle on Monday over who has the power to trigger the formal process of leaving the European Union, seeking to overturn a legal ruling that could derail its Brexit strategy.

With passions inflamed by the June vote to leave the EU, demonstrators gathered outside the court as it began hearing the government’s appeal against a ruling that ministers needed parliament’s assent before triggering the complex process.

EU supporters in judges’ robes and wigs rode a double decker bus past the court, along with a van emblazoned with the slogan “The Brexiteers have failed us all”. Rival Brexit supporters waved placards saying “This is an establishment stitch-up”.

The High Court ruled last month that Prime Minister Theresa May could not trigger Article 50 of the Lisbon Treaty and begin two years of Brexit talks with the 27 remaining EU members without parliamentary backing.

If the Supreme Court upholds the earlier ruling, that could disrupt May’s planned timetable for invoking Article 50 by the end of March, and give lawmakers opportunities to water down the government’s policies on what the terms of Brexit should be.

Launching the government’s case, its top lawyer said the earlier legal ruling was wrong, arguing that parliament had accepted before the referendum that ministers would use executive “prerogative” powers to implement its result.

“The triggering of Article 50, we say, will not be an exercise of prerogative power on a whim or out of a clear blue sky,” said Attorney General Jeremy Wright.

“It is a logical conclusion of a process in which parliament has been fully and consciously involved.”

Wright said prerogative authority, a historical power where the government acts on behalf of the monarch, was not an “ancient relic but a contemporary necessity”.

The hearing is due to last for four days and for the first time in the Supreme Court’s seven-year history all 11 justices are sitting. The verdict is expected in January.

Outside the court, a grand neo-Gothic building located on the same central London square as the Houses of Parliament, police kept an eye on rival demonstrators while inside, government lawyer James Eadie came under close questioning from the judges.

LAW NOT POLITICS

Some politicians and newspapers have portrayed the legal battle as an attempt by establishment judges to thwart the popular will. Voters opted to leave the EU by 52 to 48 percent in June’s referendum.

Slideshow ( 19 images )

The Daily Mail newspaper, which called the High Court judges “enemies of the people” after last month’s ruling, has kept up its assault on the judiciary, saying many of the Supreme Court justices had links to the EU or had expressed pro-EU views.

“We are aware of the strong feelings associated with the many wider political questions surrounding the United Kingdom’s departure from the European Union,” Supreme Court President David Neuberger said in opening remarks. “However ... those wider political questions are not the subject of this appeal.

“This appeal is concerned with legal issues and, as judges, our duty is to consider those issues impartially, and to decide the case according to the law. This is what we shall do.”

Slideshow ( 19 images )

Some lawmakers in May’s Conservative Party had called for Neuberger himself to withdraw because his wife had previously posted anti-Brexit messages on Twitter. He said all parties in the case had been asked if they wanted any of the judges to stand down and no objections had been raised.

The case was originally brought by investment fund manager Gina Miller along with hairdresser Deir Tozetti Dos Santos.

Their lawyers successfully argued at the High Court that Britons would inevitably lose rights granted by parliament when leaving the EU, and that under Britain’s unwritten constitution such rights could only be taken away with lawmakers’ approval.

If the government wins at the Supreme Court, May can invoke Article 50 by the end of March as planned. But if she loses, as many legal experts have predicted, parliament could delay or put conditions on the process, and in theory even block it.

Investors believe that greater parliamentary involvement would reduce the chances of a “hard Brexit” in which tight controls on immigration are prioritized over European single market access. The pound surged after November’s High Court ruling.

Such is the level of vitriol in the public debate over Brexit that Miller has become a target of hate and has received abuse and death threats.

“Threatening and abusing people because they are exercising their fundamental right to go to court undermines the rule of law,” said Neuberger.