PROVIDENCE, R.I. (AP) — A federal judge has blocked the Trump administration's attempt to reallocate federal Homeland Security funding away from states that refuse to cooperate with certain federal immigration enforcement.

U.S. District Judge Mary McElroy's ruling solidified a win for a coalition of 12 attorneys general that sued the administration earlier this year after being alerted to drastic reductions in federal grants due to their 'sanctuary' jurisdictions.

The cuts affected over $233 million across nine states including Connecticut, Massachusetts, and New York, funds that are allocated based on assessed risks, primarily to support local police and fire departments.

This decision came shortly after another federal ruling deemed unconstitutional the requirement for states to assist in immigration enforcement to qualify for FEMA disaster funding.

Judge McElroy found the federal government's approach arbitrary, stating, 'What else could defendants' decisions to cut funding...be if not arbitrary and capricious?...no plausible, rational formula could produce this result.'

She ordered the Department of Homeland Security to restore the previously cut allocations. McElroy highlighted that the abuse of power in grant administration is troubling, particularly as it affects the safety and security of citizens.

In her ruling, McElroy referenced the recent tragic shooting at Brown University, underscoring the vital role funds play in emergency preparedness and response. 'To hold hostage funding for programs like these based solely on what appear to be defendants' political whims is unconscionable and... unlawful,' she asserted.

Massachusetts Attorney General Andrea Joy Campbell celebrated the ruling, stating, 'This victory ensures that the Trump Administration cannot punish states that refuse to help carry out its cruel immigration agenda, particularly by denying them lifesaving funding.'