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 discovering that their states would receive drastically reduced federal grants due to their 'sanctuary' jurisdictions.

The U.S. Department of Homeland Security and the Federal Emergency Management Agency had proposed cuts amounting to more than $233 million for states including Connecticut, Delaware, the District of Columbia, Massachusetts, Minnesota, New York, Rhode Island, Vermont, and Washington. The funding cuts were part of a broader $1 billion program where allocations are based on assessed risks, primarily aimed at supporting police and fire departments.

The cuts emerged shortly after a different federal judge ruled it unconstitutional for the federal government to require states to cooperate in immigration enforcement actions as a condition for receiving FEMA disaster funding.

In her 48-page ruling, McElroy noted that the federal government's decisions regarding funding allocations were arbitrary and capricious. She argued that the decision to cut specific counterterrorism programming funding by significant amounts indicated a lack of rational criteria.

'What else could defendants’ decisions to cut funding to specific counterterrorism programming by conspicuous round numbered amounts be if not arbitrary and capricious?' McElroy wrote.

The Trump-appointed judge further ordered the Department of Homeland Security to restore the previously announced funding allocations to the plaintiff states.

McElroy expressed concern over the potential harm of such arbitrary funding decisions, especially given recent violence, citing the Brown University shooting as a tragic example where federal program funding could help mitigate similar situations in the future.

'To hold hostage funding for programs like these based solely on what appear to be defendants’ political whims is unconscionable and, at least here, unlawful,' she stated.

Massachusetts Attorney General Andrea Joy Campbell remarked that this legal victory ensures states cannot be punished for not assisting with immigration enforcement, particularly in a manner that denies them essential funding for disaster preparedness and response.