Washington (CNN) Though President Donald Trump on Friday publicly revealed his proposal to transport and release undocumented immigrants into sanctuary cities, the White House received legal guidance months ago that such a policy would run afoul of the law, open the administration to lawsuits, and ultimately undermine the President's desire to deport undocumented immigrants.

In February, according to documents obtained by CNN, the general counsel for the Department of Homeland Security, John Mitnick, told the White House in writing that such a move could only be done if there was a "strong, mission-related rationale" pertaining to the responsibilities of DHS.

The reasons the President has publicly stated for the policy proposal -- one that senior administration officials tell CNN he has been pushing for behind the scenes for months -- are decidedly not related to the DHS mission statement.

"Due to the fact that Democrats are unwilling to change our very dangerous immigration laws, we are indeed, as reported, giving strong considerations to placing Illegal Immigrants in Sanctuary Cities only," Trump tweeted Friday. "The Radical Left always seems to have an Open Borders, Open Arms policy -- so this should make them very happy!"

Mitnick, whose insistence that immigration policies and actions fall within the confines of the law, has aroused the ire of Trump, top aide Stephen Miller and other immigration hardliners in the White House, made it clear in his legal guidance that the "mission related rationale" for transporting undocumented immigrants did not include political retaliation.

Read More