President Trump on Thursday said his administration will begin withholding funding from self-described sanctuary cities after a federal court ruled last week that it could do so.

"As per recent Federal Court ruling, the Federal Government will be withholding funds from Sanctuary Cities," Trump tweeted. "They should change their status and go non-Sanctuary. Do not protect criminals!"

The 2nd Circuit Court of Appeals in Manhattan ruled on Feb. 26 that the Department of Justice (DOJ) could withhold funding from cities and states that refuse to cooperate with the Trump administration's crackdown on undocumented immigrants.

The three-judge panel found Congress had delegated authority to the attorney general to set conditions on the federal grant program it had created, called the Edward Byrne Memorial Justice Assistance Grant Program.

The decision came after multiple courts had ruled against the Trump administration on the issue, saying it lacked the authority to impose immigration-related conditions on certain funding.

A group of seven states and New York City sued the DOJ in 2017 after then-Attorney General Jeff Sessions announced that the agency would start withholding funding from local governments that refused to share information about undocumented immigrants or provide jail access to federal authorities investigating inmates' immigration status.

Officials that backed the lawsuit pledged to challenge the appeals court ruling.

Sanctuary cities typically refuse to cooperate with the federal government to enforce federal immigration laws, offering a safe haven for undocumented immigrants. Trump regularly blasts sanctuary cities during his campaign rallies, citing them to accuse Democrats of supporting lax immigration laws.