LONDON — After Prime Minister Theresa May rolled out the red carpet at Blenheim Palace on Thursday night for President Trump’s first official visit to Britain, a London tabloid published an explosive interview in which Trump blasted May’s compromise, pro-business plan to leave the European Union and warned that her approach could imperil any future trade deal between the United States and Britain.

The remarks cast an immediate pall over a visit that included a lavish dinner with business leaders Thursday night and plans to meet Queen Elizabeth II for afternoon tea on Friday. It was the latest international incident to erupt during Trump’s brief sojourn abroad, which kicked off with incendiary comments that upended a NATO summit in Brussels and further strained relationships with longtime U.S. allies.

In addition to attacking May on Brexit, Trump also praised her archrival, Boris Johnson, as a potential future prime minister while attacking London’s mayor as soft on crime and terrorism.

May’s office did not issue a reply to Trump’s remarks but referred reporters to an earlier statement: “We have come to an agreement at the proposal we’re putting to the European Union which absolutely delivers on the Brexit people voted for. They voted for us to take back control of our money, our law and our borders and that’s exactly what we will do.”

Newspaper editors scrambled to update their front pages. “The ego has landed,” said the Daily Mirror, adding that Trump “embarrasses Prime Minister with attack on her plan for soft Brexit.” On its front page, the Daily Mail said Trump had offered “typically blunt home truths for Britain.”

In the interview, done earlier this week, Trump disparaged May’s Brexit plan: “I would have done it much differently. I actually told Theresa May how to do it, but she didn’t listen to me.”

He added: “The deal she is striking is a much different deal than the one people voted on.”

If May has Britain align its rules and regulations for goods and agricultural products with Europe, following “a common ­rule book” with Brussels, as May puts it, then, Trump said, that could derail a trade deal with Washington.

“If they do a deal like that, we would be dealing with the European Union instead of dealing with the U.K., so it will probably kill the deal,” Trump told the Sun, which published its splash at 11 p.m. in Britain.

Trump was scheduled to meet with May for talks on Friday.

Activists inflate a giant balloon depicting President Trump as an orange baby ahead of protests in London. (Isabel Infantes/AFP/Getty Images)

“The President likes and respects Prime Minister May very much. As he said in his interview with the Sun she ‘is a very good person’ and he ‘never said anything bad about her,’ ” U.S. press secretary Sarah Huckabee Sanders said in a statement. “He thought she was great on NATO today and is a really terrific person.”

The U.S. contingent expected the story to post Friday morning and was startled to leave the dinner Thursday and see it online. Sanders told the British government about the interview but thought it would be somewhat more positive, an official said.

White House officials were scrambling for what to say to May on Friday. “There’s no way Trump will apologize,” a senior U.S. official said. “But we also don’t want to blow everything up.”

A second White House official said Trump had two days of positive interactions with May. But the official also conceded that Trump had talked about her vulnerabilities and criticized her political acumen privately for many months.

The officials spoke on the condition of anonymity to discuss internal conversations.

Trump also said to the Sun that he was not spending much time in London on this trip because he did not feel welcome, due to mass demonstrations planned for Friday.

“I guess when they put out blimps to make me feel unwelcome, no reason for me to go to London,” he told the paper. “I used to love London as a city. I haven’t been there in a long time. But when they make you feel unwelcome, why would I stay there?”

Trump lashed out at London Mayor Sadiq Khan, too, saying that he’s done a “bad job” on tackling terrorism and crime.

“Take a look at the terrorism that is taking place. Look at what is going on in London. I think he has done a very bad job on terrorism,” Trump said. “I think he has done a bad job on crime, if you look, all of the horrible things going on there, with all of the crime that is being brought in.”

But he spoke glowingly of Johnson, who quit the cabinet this week in protest over May’s plans for a soft Brexit.

“I have a lot of respect for Boris. He obviously likes me and says very good things about me,” Trump told the tabloid. “I was very saddened to see he was leaving government, and I hope he goes back in at some point. I think he is a great representative for your country.”

Asked whether Johnson could find himself in 10 Downing Street one day, Trump said, “Well I am not pitting one against the other. I am just saying I think he would be a great prime minister. I think he’s got what it takes.”

Trump did not have public events in Britain on Thursday. Planners have taken great care to keep him from protests.

After his trips overseas to Asia and the Middle East, Trump went on for days about the grandiose treatment — and the Brits were clearly trying to do well by him.

At the dinner, in her remarks, May made her pitch to Trump. She began by noting that “Sir Winston Churchill once said that ‘to have the United States at our side was, to me, the greatest joy.’ ”

Then she moved to the deals she hoped to strike. “Now, as we prepare to leave the European Union, we have an unprecedented opportunity to do more. It’s an opportunity to reach a free trade agreement that creates jobs and growth here in the U.K. and right across the United States,” she said.

The prime minister said that Brexit offered the chance “to tear down the bureaucratic barriers that frustrate business leaders on both sides of the Atlantic,” according to an account provided by 10 Downing Street.

An hour later, the interview with the Sun appeared and seemed to dash May’s hopes.

Brian Klaas, a fellow in global politics at the London School of Economics, said May is walking a tightrope. She needs Trump to promise fantastic trade deals and help May deliver the “global Britain” she has promised. But she can’t appear fawning.

“Her political base and the broader British public do not like Donald Trump,” Klaas said. “She also wants to show that in a post-Brexit world, Britain can still be a major player, and Trump is central to that narrative.”

Robin Niblett, director of Chatham House, a London think tank, said that for May, the Trump visit “was something to be survived.”

Recalling the disaster that struck British leader Tony Blair, in his embrace of George W. Bush and his alliance with Washington in the Iraq War, Niblett said May would be extremely wary of being seen as “Trump’s poodle.”

Organizers of Britain’s nationwide protests are committed to staging some of the largest demonstrations since 2003, when hundreds of thousands hit the streets to oppose war in Iraq.

Organizers said that from the moment Trump landed on British soil to the moment he leaves, he will be met by a “carnival of resistance.” A giant “Trump Baby” balloon will fly over Parliament Square. Protesters plan to shout at Trump at places he will be visiting — Winfield House, Blenheim Palace, Chequers, Windsor Castle and his Trump Turnberry golf resort in Scotland. Others will assemble in towns and cities up and down the country.

“I’m marching because of the disdain that Trump has shown for Britain and because of his disgraceful treatment of minorities in the United States,” said David Lammy, a leading member in the opposition Labour Party.

“Whenever London experiences a tragedy, it’s also the case that Trump licks his lips and tweets,” he said.