A federal judge on Friday blocked the Internal Revenue Service from sharing data with immigration enforcement officials, ruling that the tax agency violated federal law and the rights of tens of thousands of individuals in its attempt to participate in President Donald Trump’s mass deportation campaign. 

The Treasury and Homeland Security departments in April formalized an agreement to share confidential information about taxpayers who the Trump administration suspected of being in the country illegally.

Under the terms of the deal, signed by Treasury Secretary Scott Bessent and Homeland Security Secretary Kristi L. Noem, immigration officials would provide the IRS with names, addresses and other identifying information for individuals they wished to detain and deport. The IRS would cross check those details against confidential databases to confirm the individuals’ identity and location.