Donald Trump suggested Prime Minister Sir Keir Starmer could use the military to stop illegal migration at a news conference marking the end of the US president's second state visit to the UK.

Trump said he discussed migration issues with Sir Keir during a meeting at his country residence Chequers.

The US president talked about his policies to secure borders in the US and said the UK faced a similar challenge with migrants crossing the English Channel in small boats.

You have people coming in and I told the prime minister I would stop it, and it doesn't matter if you call out the military, it doesn't matter what means you use, Trump said.

It destroys countries from within and we're actually now removing a lot of the people that came into our country.

Since his return to the White House in January, Trump has stepped up deportations of illegal immigrants and cracked down on unlawful border crossings.

In two days of pomp and pageantry, the US president was hosted at Windsor Castle by King Charles and the Royal Family, and attended a state banquet on Wednesday before his political talks with the prime minister on Thursday.

The President and First Lady Melania Trump departed the UK from Stansted Airport on Air Force One shortly after the news conference.

In a wide-ranging Q&A with UK and US journalists, the leaders were also asked about Palestinian statehood, free speech, the war in Ukraine, energy and other topics.

The pair touted the special relationship between the UK and the US, and announced a new tech deal Trump said would help the allies dominate in the world of artificial intelligence (AI).

Trump and Sir Keir skirted around several contentious matters, including accusations of free speech being under attack in Britain, and the sacking of Peter Mandelson as the UK's ambassador to the US last week.

In what could have been an awkward moment, Trump defused the question by handing over to Sir Keir, who fired Lord Mandelson over his links to the late convicted sex offender Jeffery Epstein.

Sir Keir said his government had struck several migrant returns deals with other countries, including France, and had been taking action to crack down on people-smuggling gangs.

The prime minister pointed to the first migrant return under the one-in-one-out scheme with France. That's an important step forward, Sir Keir said. But there's no silver bullet here.

More than 30,000 people have crossed the Channel in small boats so far this year. It is the earliest point in a calendar year this figure has been passed since data on crossings was first reported in 2018.