London (CNN) - Brexit, it's sometimes said, will be decided by whichever side has the best lawyers.
As the UK's painful divorce from the European Union drags on, the flagship policy of Boris Johnson's government is increasingly facing more time in the courts.
On Wednesday, Scotland's highest court ruled that Johnson's decision to suspend Parliament was motivated by the "improper purpose of stymying Parliament."
The implication is that Johnson's claim that he suspended Parliament in order to bring forward a new legislative agenda was untrue. The court agreed that Johnson's true motivation was to dodge scrutiny from UK lawmakers as he tries to ram Brexit through on October 31, deal or no deal.
The case will now be heard in the UK's top court, the Supreme Court, on Tuesday. Should a majority of nine justices agree with the Scottish ruling, it will be Johnson's most significant defeat so far -- and that's saying something.
Another rumbling case that could impede Johnson underscores how serious Brexit it is for Northern Ireland, the smallest nation that makes up the UK.
On Thursday, a Northern Irish court rejected a claim that the UK's plan for a no-deal Brexit would break the terms of the Good Friday peace agreement. The case will be appealed and could ultimately end up in the Supreme Court on Tuesday, too.
In Northern Ireland, Brexit is not a game. A no-deal Brexit would almost certainly lead to a need for some kind of infrastructure on or near the border between the Republic of Ireland, an EU member state, and Northern Ireland, which remains part of the UK.
It's important to note that this case is supported by a man called Raymond McCord, a campaigner whose son was murdered by a pro-Unionist paramilitary group in 1997, aged 22. Earlier this year, Lyra McKee, a Northern Irish journalist, was killed while covering a night of violent clashes between republican terrorists and the police. The New IRA accepted responsibility for the murder. In Northern Ireland, political unrest can quickly turn into something far uglier.
The government rejects the idea that no deal would breach the Good Friday Agreement and claims to remain committed to avoiding friction on the border. How it hopes to achieve this, however, is legally unclear.
Should either or both of these rulings go against the government, the political momentum building against Johnson and his government will increase.
These two cases are unlikely to be the last legal challenges Johnson faces. There is a tussle brewing over his public indication that he is planning on ignoring legislation passed by Parliament to request a Brexit extension, among other things. And, unfortunately for Johnson, quite a lot of those standing up to him in Parliament are distinguished lawyers.
No matter how many legal tight spots Johnson is in, true victory, ultimately, will be decided in the court of public opinion. It's fairly obvious that the UK is gearing up for a general election. With no majority for anything in Parliament and a government unable to pass any legislation, an election that delivers a majority seems the only way to break the Brexit deadlock at the moment.
Johnson's team has already shown its hand. We know that some inside the government are willing to run on a ticket that isn't a million miles from the Donald Trump playbook. If Johnson is legally forced to request a Brexit extension, the campaign will be simple: I tried to give you Brexit but the remainer politicians stopped me. The lawyers stopped me, the civil service stopped me and the judges stopped me. Sound familiar?
On Wednesday night, following the Scottish ruling on the suspension of Parliament, a member of Johnson's government said on national television that "many people, many Leave voters, many people up and down the country, are beginning to question the partiality of the judges."
The minister, Kwarsi Kwarteng, added: "I'm not saying this, but, many people... are saying that the judges are biased." Followers of US President Donald Trump will recognize this nod-and-wink way of introducing controversial views.
The next day's papers went a step further, with the Brexit-supporting Daily Mail dedicating a double-page spread, highlighting the judges' alleged European sympathies. This is the same newspaper that in 2016 called three judges "Enemies of the People" after they ruled that Parliament must be given a vote on triggering article 50, the mechanism by which a member state leaves the EU.
It's becoming pretty obvious where all this ends up. The UK's failure to leave the EU three years after the Brexit vote has widened the divide in an already toxic political debate. Some Brexiteers are so furious at Brexit being stolen that they no longer want any kind of deal and see anything other than a no-deal Brexit as a betrayal. Remainers are increasingly confident that they can use clever legal mechanisms to frustrate Brexit and are hopeful that they can still trigger a second referendum.
An election campaign will turn up the volume on a din that's already unbearable. And even if Johnson does do the seemingly impossible and get a fresh deal from Europe, its chances of passing through Parliament without an enormous fight is slim at best. Thus, the saga drags on and the national conversation becomes increasingly bitter.
Boris Johnson, it should be said, is not a British Donald Trump. Suggesting so would be disingenuous. Throughout Johnson's political career, his publicly-stated views on how he sees the world have always been far closer to liberal internationalist than right-wing populist.
Nevertheless the Trump line of attack is an effective one for his opponents, given how unpopular the President is in the UK. The characterization may not be true, but the Brexit debate has become so toxic here that it's comparable to the atmosphere in Trump's America.
In that sense, the UK is having its Donald Trump moment.