LONDON — Britain and the U.S. may have a special relationship but President Donald Trump’s state visit will be a diplomatic balancing act for the U.K., where Trump is deeply unpopular.

Even before his arrival on British shores, the president caused a stir by wading into the contest to replace Theresa May as prime minister and criticizing Meghan Markle, the Duchess of Sussex.

Trump's trip comes as the U.K. is facing its most significant crisis since the Second World War.

It is currently in the midst of a long and messy divorce from the European Union, the economic and political bloc it has belonged to for more than 40 years.

That divorce has now brought down a second prime minister in less than three years.

May announced on May 24 that she will step down as prime minister and leader of her ruling Conservative party just days after the president's visit. Her party is now in the midst of a heated race to decide who will be its next leader — and the country's next prime minister.

In an interview Friday with the British tabloid The Sun, Trump said Boris Johnson — the divisive populist and ex-foreign secretary who is favorite to replace May — would make an "excellent" prime minister.

"I think Boris would do a very good job. I think he would be excellent," Trump said.

The president also referred to the American-born Duchess of Sussex as "nasty" over comments she made in 2016 threatening to move to Canada if Trump won the White House.

But he wished her well in her new life as a princess. "I am sure she will do excellently," he added.

The comments threatened to overshadow the build up to Trump's long-awaited state visit.

Trump is widely disliked in the U.K. He has a positive opinion rating of only 21 percent, according to YouGov, compared to 72 percent for former President Barack Obama.

But he told The Sun Friday that “I don’t imagine any U.S. president was ever closer to your great land.”

"Now I think I am really — I hope — I am really loved in the U.K.," he added. "I certainly love the U.K."

On Tuesday, the day after Trump’s arrival, thousands of people are expected to hit the streets of the capital to protest, like they did during his last visit in July.

It was a similar story for President George W. Bush, whose state visit came eight months after the invasion of Iraq.

Demonstrators protest against President Donald Trump's visit to the U.K. in July 2018. Yves Herman / Reuters file

Yet it’s precisely because of the U.K.'s Brexit mess that it needs this visit now more than ever.

With no Brexit deal in sight, and future trade ties with Europe now up in the air, a trade deal with the U.S. has become increasingly important.

“The cleaner the Brexit, the easier it is for the U.S. to strike a free trade deal with the U.K.,” said Leslie Vinjamuri, the head of the U.S. and Americas program at the Chatham House think tank.

“That plays into the hands of those who are pushing for a hard Brexit,” from the E.U. with no agreement setting out a framework for future relations.

On his last visit to the U.K., Trump didn’t hold back.

He blasted May over Brexit and warned that her plan could scuttle an American trade deal with the U.K. because Britain would remain too close with the E.U.

In his interview Friday Trump again criticized May's handling of Brexit, saying she "didn't give the European Union anything to lose" in negotiations.

“Any foreign intervention into something as sensitive as Brexit is tricky and likely to put people in a bad political position. People here will be very nervous on the extent to which they engage with it,” said Vinjamuri.

President Barack Obama and first lady Michelle Obama met Britain's Prince William and Catherine, Duchess of Cambridge, at Buckingham Palace, in May 2011 during their state visit. Reuters file

There are few precedents when it comes to presidential state visits. This is only the third for a U.S. president since the queen assumed the throne in 1952, with Bush receiving the honor in 2003 and Obama in 2011. The queen only hosts one or two state visits a year.

This trip will stand in stark contrast to Obama’s visit in particular.

Obama and his wife Michelle were welcomed by the queen, as well as the glamour couple of the time, Prince William and Kate, the Duchess of Cambridge, who had married only a month earlier. Their Buckingham Palace banquet was filled with glitz and glamour and included former prime ministers as well as the mayor of London, and even actor Tom Hanks.

Ahead of Trump's arrival, however, some of the U.K.’s most senior politicians have said that the visit is a mistake and that they won’t attend the Queen’s uber-formal state dinner at Buckingham Palace.

Opposition Labour Party leader Jeremy Corbyn has refused to join the white tie event and said that May "should not be rolling out the red carpet for a state visit to honor a president who rips up vital international treaties, backs climate change denial and uses racist and misogynist rhetoric."

Corbyn, however, has been criticized for inviting members of Hamas and Hezbollah to an event in Parliament in 2009 and for calling the groups “friends.” Both groups are classified by the U.K. and U.S. as terrorist groups and have repeatedly called for the destruction of the State of Israel.

But he’s not the only political leader refusing to meet with the president.

Vince Cable, leader of the centrist Liberal Democrats, also turned down a seat at the dinner with Trump.

And Mayor of London Sadiq Khan said the U.K. was wrong to "roll out the red carpet" for Trump. In an article for The Observer newspaper on Sunday, Khan also likened the president's rhetoric to that of the "fascists of the 20th century."

Trump struck back at Khan on Monday morning just before landing at Stansted Airport, a budget airline hub around 35 miles outside of London. The president tweeted that Khan is "a stone cold loser who should focus on crime in London, not me."

Despite the objections to Trump's visit and the difficulty for U.K. politicians to head off any explosive comments the president may make, experts say that the close relationship between the two countries is bigger than their leaders.

“The government has made big attempt to say to people that however much you may find Trump objectionable you must distinguish the man from the office,” said the former Ambassador to the U.S. Christopher Meyer.

"This is a state visit, this is an honor for the whole of the U.S."