President Trump has praised the mayor of Miami-Dade after he ordered the city's jails to comply with the crackdown on 'sanctuary' counties.

Donald Trump has issued an executive order directing federal agencies to take away funding from self-proclaimed 'sanctuary cities' that limit cooperation with immigration authorities.

Unlike cities like San Francisco, Miami-Dade never officially labelled itself a 'sanctuary', but since 2013 has refused to indefinitely detain inmates who are in the country illegally and wanted by ICE.

President Trump has praised the mayor of Miami-Dade Carlos Gimenez (pictured) after he ordered the city's jails to comply with the crackdown on 'sanctuary' counties

President Trump has since tweeted his support for the decision. 'Miami-Dade Mayor drops sanctuary policy. Right decision. Strong!,' he wrote on Thursday

However, that still landed the city on the list of 'sanctuaries' in the Justice Department's May 2016 report.

On Thursday, fearing cuts of millions of dollars, Miami-Dade Mayor Carlos Gimenez, a Republican who said he voted for Hillary Clinton in the last election, decided to make the city's position clear.

'In light of the provisions of the Executive Order, I direct you and your staff to honor all immigration detainer requests received from the Department of Homeland Security,' Gimenez wrote to Daniel Junior, the interim director of the corrections and rehabilitation department.

The memo effectively means that Miami-Dade can no longer be considered a safe port for immigrants in the country illegally.

President Trump has since tweeted his support for the decision.

'Miami-Dade Mayor drops sanctuary policy. Right decision. Strong!,' he wrote on Thursday.

Last year, the county refused to detain around 100 illegal immigrants wanted by the authorities, on the grounds that it would have cost $52,000 our of their $7 billion annual budget.

But the country receives millions in federal funding for elderly care, homeless shelters and more, according to the Miami Herald.

'I want to make sure we don't put in jeopardy the millions of funds we get from the federal government for a $52,000 issue,' he said. 'It doesn't mean that we're going to be arresting more people. It doesn't mean that we're going to be enforcing any immigration laws.'

Donald Trump has issued an executive order directing federal agencies to take away funding from self-proclaimed 'sanctuary cities' that limit cooperation with immigration authorities

Immigration groups were preparing to fight Trump's executive order on Wednesday.

Lawyers for the potential challengers pointed to court rulings that said the federal government can only withhold funds to local jurisdictions if the money is directly tied to the behavior it objects to.

Trump had previously promised that even if a sanctuary city was penalized with cuts, the police departments would be protected.

But Richard Doyle, city attorney in San Jose, California, insists the Trump administration cannot cut funds for sanctuary cities' healthcare and education while preserving money for police, since those jobs relate more closely to immigration enforcement. He said it was not clear whether existing federal funding or only future grants would be targeted.

Supporters of the new Republican president's actions say that sanctuary cities ignore federal law and think the White House will be able to answer with a strong case in court.

Federal law allows Trump to restrict public assistance 'of any kind where an illegal alien could possibly benefit,' said Dale Wilcox, executive director of the Washington-based conservative Immigration Reform Law Institute.

The White House did not immediately respond to a request for comment.

In New York City, Mayor Bill de Blasio in a news conference said his chief legal officer would be in court the 'hour' after any specific action to withhold money came through.

'We will not deport law-abiding New Yorkers', he said, as he blasted Trump's executive order against sanctuary cities and pledges to protect undocumented immigrants.

Mayor Bill de Blasio in a news conference said his chief legal officer would be in court the 'hour' after any specific action to withhold money came through and pledged not to deport law-abiding New York citizens

'There is less here than meets the eye. This executive order is written in a very vague fashion,' said de Blasio, a Democrat.

San Francisco City Attorney Dennis Herrera, also a Democrat, said his office was still examining whether it could sue before Trump made any specific move to cut funds.

Trump's order directed that funding be slashed to all jurisdictions that refuse to comply with a statute that requires local governments to share information with immigration authorities.

Omar Jadwat, director of the American Civil Liberties Union's Immigrants' Rights Project, said the cities can argue 'they are fully in compliance with that statute,' since they do share information with federal authorities, but offer limited cooperation when it comes to turning over immigrants who are not convicted criminals.

There could also be procedural snarls to implementing the cuts, lawyers who specialize in federal grants said. If the U.S. government seeks to cut off grants to a certain recipient, it must go through a complicated process known as 'suspension and debarment,' and cities would have the right to appeal.

'It's fair to say that they don't understand the scope and reach of federal grants law,' said Edward Waters, who heads the federal grants practice at the law firm Feldesman Tucker Leifer Fidell in Washington, referring to the Trump administration.

Immigration groups were preparing to fight Trump's executive order on Wednesday (file picture of protests in Miami-Dade last year)

The White House would also have to negotiate with states that are home to sanctuary cities. Nearly 90 percent of $652 billion the federal government handed out through more 1,500 separate grant programs in the most recent fiscal year went to states, not directly to cities, according to a Reuters review of federal spending data.

If the Trump administration wanted to try to cut off Medicaid money to Chicago, for example, it would have to work through the state government of Illinois, which could pose an additional barrier, Waters said.

Advocacy groups for immigrants' rights said they are also preparing their own legal challenges to other aspects of two executive orders Trump signed on Wednesday, examining sections that deal with expanding detention of immigrants and changing how asylum requests are processed.