LONDON — Prime Minister Theresa May on Sunday revealed the advice President Trump had given her on how to negotiate Britain’s withdrawal from the European Union: Go straight to court.

Mrs. May was asked by the BBC about comments Mr. Trump made both in an interview in the British tabloid The Sun and later at a news conference on Friday at Chequers, the prime minister’s country residence, northwest of London.

“He told me I should sue the E.U.,” Mrs. May said.

Her comments will most likely be seen as pushing back against Mr. Trump, who had criticized her for ignoring his suggestion and whose interview in The Sun embarrassed the prime minister just as she was rolling out the red carpet for his working visit to England, one that she had hoped would showcase the strength of trans-Atlantic ties.

At the news conference, Mr. Trump, without revealing what he had advised Mrs. May, said that she had seemed to regard his suggestion as too “brutal.”