Mayor Bill de Blasio said Monday that President Trump’s plan to send undocumented immigrants to sanctuary cities like New York is illegal and vowed to fight it in court.

De Blasio made the statement on NY1 after Trump continued to threaten to send undocumented immigrants to so-called sanctuary cities on Monday.

“It’s illegal. It is just plain illegal. We will meet him in court. We will beat him in court,” de Blasio said.

“I remember vividly the day the Trump administration, when he said he was going to cut our security funding because we did not ask for documentation status, because we would not cooperate with everything ICE was doing,” he added.

“We said we would go to court to stop it and we did.”

Earlier on Monday, Trump took to Twitter to say his plan to transport illegal migrants to sanctuary cities would move forward.

“Those Illegal Immigrants who can no longer be legally held (Congress must fix the laws and loopholes) will be, subject to Homeland Security, given to Sanctuary Cities and States!” Trump wrote on Twitter Monday afternoon.

Last week, Trump first publicly floated the idea of sending migrants to sanctuary cities, where local authorities don’t report immigration status of residents to federal authorities.