What an absolute shitter the legal system is over there. Share information requested by legal officials, get sued by the government. Don't share information requested by legal officials, get detained. Maybe it should be the officials asking for this information who should be getting prosecuted.
Edit: This is how it looks to an outsider, I guess its more nuanced than that - but it should be black and white.
There are two different independent governments involved. One is conservative and wants aggressive illegal immigration enforcement. The other is liberal and wants to prevent such enforcement from affecting legal immigrants and citizens. Each is sovereign and independent to a degree.
It's the same thing with marijuana. Legal in many states, but illegal under federal law.
Edit: This is how it looks to an outsider, I guess its more nuanced than that - but it should be black and white.