Image copyright Getty Images Image caption Mr Trump on Tuesday denied reports that his administration was planning to separate migrant families

US President Donald Trump has lashed out at a judge for blocking his policy of sending asylum seekers to Mexico to await court hearings in their cases.

"A 9th Circuit judge just ruled that Mexico is too dangerous for migrants," he tweeted. "So unfair to the US."

His policy would have returned migrants back over the border while they sought a legal right to stay in the US.

The legal defeat comes as migrant numbers at the US-Mexico border surged to their highest since 2008.

Mr Trump was said to be livid after US immigration officials estimated border apprehensions in March had topped 100,000.

The San Francisco federal judge's order on Monday against the migrant policy is not due to go into effect until this Friday.

The White House said in a statement on Tuesday it would appeal the decision.

"This action gravely undermines the president's ability to address the crisis at the border with the tools Congress has authorised and disrupts the conduct of our foreign affairs," the White House said in a statement.

"We intend to appeal, and we will take all necessary action to defend the executive branch's lawful efforts to resolve the crisis at our southern border."

Meanwhile, the Department of Homeland Security (DHS), which implements Mr Trump's immigration directives, is in turmoil following a major shake-up.

DHS Secretary Kirstjen Nielsen quit on Sunday after being summoned to the White House by the president.

This was followed by the resignation of the agency's acting deputy secretary, Claire Grady, on Wednesday. Ms Grady was legally supposed to take over from Ms Nielsen.

Republican Senator Chuck Grassley called on Mr Trump on Monday to halt the leadership purge at the DHS.

The senior senator told the Washington Post he was "very, very concerned" about reports of possible further dismissals.

"The president has to have some stability and particularly with the number one issue that he's made for his campaign," Mr Grassley said.

"He's pulling the rug out from the very people that are trying to help him accomplish his goal."

Last week Mr Trump rescinded his own nomination of Ronald Vitiello as director of Immigration and Customs Enforcement (ICE).

Speaking to Fox News on Monday, White House spokesman Hogan Gidley said: "It's time to do things a little differently.

Media playback is unsupported on your device Media caption The boy who risked his life for an American dream

"The president's looking around to reshape his team so he can have the people in place to carry out his agenda."

There are also reports that the president is preparing to toughen his stance on immigration.

According to the New York Times, Mr Trump is considering implementing further limits on asylum seekers, ending birthright citizenship, and closing ports of entry at the Mexican border.

But Mr Trump denied on Tuesday reports that his administration was planning once again to separate families caught crossing the border.

"We are not looking to do it," he said.

He added: "Once you don't have it [child separation], that's why you see many more people coming. They're coming like it's a picnic because let's go to Disneyland."

Media playback is unsupported on your device Media caption 'I thought we would be treated differently in US'

More than 2,700 immigrant children were separated from their parents last year under a so-called zero tolerance US policy to prosecute anyone caught crossing the border illegally.

According to US media, the White House has recently been considering a "binary choice" policy.

This would give migrant parents awaiting immigration hearings two options: agree for their child to be held separately, or be detained together, possibly indefinitely, until their court date.

A 1997 court decision known as the Flores agreement states that immigrant children are only allowed to be held for 20 days.

Image copyright Getty Images Image caption Stephen Miller (centre) listens as President Trump speaks at a border security round-table discussion

The Trump administration has reportedly drafted a regulation to change these rules, an official told the Axios news website, so that the government could detain children for longer periods of time.

Senior White House adviser Stephen Miller is said to be encouraging the president to adopt an increasingly hardline stance on immigration.

Democratic congresswoman Ilhan Omar on Monday called Mr Miller "a white nationalist" on Twitter.

Mr Trump fired back at Ms Omar on Twitter, calling her criticism of Mr Miller, who is Jewish, anti-Semitic.

"'What's completely unacceptable is for Congresswoman Omar to target Jews, in this case Stephen Miller'", Mr Trump wrote, citing a segment on Fox Business Network.

Republican Congressman Lee Zeldin also condemned Ms Omar for her comments.

"During my time in Congress before @IlhanOmar got here, I didn't once witness another Member target Jewish people like this with the name calling & other personal attacks", Mr Lee wrote. "For @IlhanOmar, this is just called Monday."

The comments follow widespread condemnation of Ms Omar last month for her criticism of pro-Israel lobbyists in Washington DC.

Image copyright Getty Images Image caption Former President Barack Obama speaks to young leaders from across Europe

Meanwhile, amid an ongoing debate about immigration on both sides of the Atlantic, former President Barack Obama told young people at a town hall meeting in Berlin, Germany: "We can't label everybody disturbed by immigration as racist."

He also said immigrants should be encouraged to learn the language of their adopted country.