Donald Trump has launched an extraordinary attack on Theresa May, saying she ignored his advice on Brexit and had, therefore, put a potential trade deal with the US at risk.

The interview appeared in The Sun, Britain's biggest-selling newspaper, and was published shortly after May delivered a speech to welcome the US president to Britain.

The timing of the comments could not be worse for May, who is fighting a rebellion among her own MPs over Brexit which has seen Brexit secretary David Davis and foreign secretary Boris Johnson quit her government.

Referring to the prime minister's most recent proposals which would keep a degree of alignment between UK and EU rules to smooth trade between the two partners, Trump said: "If they do a deal like that, we would be dealing with the European Union instead of dealing with the UK, so it will probably kill the deal."

"I actually told Theresa May how to do it, but she didn't listen to me."

He also added that Johnson, "would be a great Prime Minister."

After the story was published, White House spokeswoman Sarah Sanders said the president "likes and respects Prime Minister May very much," adding that he said in the interview she "is a very good person", and that he "never said anything bad about her."

A trade deal with the US is one of the key ambitions of those who called for the UK to leave the EU. Trump's comments mirror criticism from the likes of former UKIP leader Nigel Farage who has warned that European rules prevent the UK from running its own trade policy.

Just hours before Trump's interview was published, May invoked Winston Churchill, a hero of Trump, as she addressed the US president and business leaders at a black-tie dinner at Blenheim Palace, the grand 18th-century country house that was the birthplace of the British World War Two leader.