US President Donald Trump's state visit to the United Kingdom this week will be no stranger to controversy, just as his first was six years ago.

Back then, in June 2019, as well as taking tea with the late Queen, the US President called London Mayor Sadiq Khan 'a stone-cold loser', backed Boris Johnson in a Tory leadership race, and suggested the NHS should be part of US-UK trade talks.

All this was accompanied by a petition saying he should not receive a state visit in the UK, signed by more than one million people, as well as noisy protests involving thousands and a huge inflatable effigy that became known as the Trump Baby.

This week's second state visit – unprecedented for a non-royal - will prove the first was no exception.

There will again be protests, and Lord Mandelson's sacking as UK ambassador to the US has already cast a diplomatic pall over proceedings.

Planning for the visit - over Wednesday and Thursday - has gone on for months, but for all the careful preparation, the possibility that things could go wrong is still very real.

For many of those organising it, the Mandelson affair is only one of their worries.

How Windsor became 'Trumpton'

For those at the royal end of the show, the focus has been on logistics and security - and turning Windsor Castle into a ring of steel hard enough to satisfy even the most fastidious secret service agents.

Such has been the huge American presence some locals have renamed Windsor Trumpton, after the eponymous town in the 1970s children's TV show.

'Pressure to make this massive'

So far, so logistical – but the key challenge for royal organizers has been ensuring Trump feels he has been given a full state visit with all the trimmings. That is no easy task.

The president is on the ground for less than 48 hours and will not visit Downing Street, address Parliament, or even find time to play a round of golf.

There has been a large amount of government pressure to make this massive and that's been the challenge, one courtier told me.

Serious business behind the pageantry

Beyond providing a day of royal pageantry, the government has business to conduct on Thursday when proceedings move to the prime minister's country residence at Chequers.

Ministers hope to complete a deal to exclude UK steel and aluminium from US tariffs. There will be some new civil nuclear cooperation.

The centrepiece is set to be the signing of a technology partnership, involving new investment in Britain and greater cooperation with Silicon Valley on artificial intelligence and quantum computing.

This was Lord Mandelson's priority, something he described in his outgoing letter to embassy staff last week as my personal pride and joy", that he claimed would help write the next chapter of the special relationship.

All these issues will be portrayed as big domestic wins to help promote the government's growth agenda.

The visit will also provide Prime Minister Sir Keir Starmer with a significant opportunity to influence the president just a week before the United Nations general assembly in New York, especially on Ukraine.

The Mandelson question

For all these potential gains, the risks are huge and the most obvious involves, of course, Lord Mandelson.

The peer's dismissal as ambassador, after revelations of the scale of his friendship with Jeffrey Epstein following Epstein's conviction as a paedophile, means the press conference at Chequers on Thursday will not be dominated by questions about his future.

Instead, the prime minister will likely be asked why he appointed the peer in the first place and why he took so long to sack him; what did he know and when?

Profound differences in the UK and US

The Mandelson affair is not the only potential challenge. As one distinguished former British ambassador told me: On values and policies, we have fundamental differences with the Trump administration – on NATO, Ukraine, Middle East and China.

The differences are more profound than at any time since World War Two.

Perhaps the most acute difference that could overshadow the visit relates to the Middle East.

Next week the UK is expected to formally recognize Palestinian statehood in an attempt to keep alive the idea of a so-called two-state solution. But the Americans are strongly opposed, as Secretary of State Marco Rubio made clear on Friday, emphasizing his commitment to fight anti-Israel actions including unilateral recognition of a Palestinian state that rewards Hamas terrorism.

There are also political risks for the prime minister. Underlying this state visit is an unspoken transaction: that it is worth giving Trump all those trimmings in order to help British interests, namely to reduce tariffs and foster investment partnerships.

Yet Trump is unpopular in the UK. A YouGov poll in July found only 16% of Britons surveyed say they have a positive view of him.

The government will have to explain to voters why it believes this state visit is a price worth paying to try to grow the British economy.