A federal judge in Rhode Island blocked the Trump administration’s plan to shift homelessness funding toward treatment programs on Friday. Judge Mary S. McElroy said the government exceeded its authority. Ann Oliva said, "Safe and affordable housing ends people's homelessness." The ruling protects billions in aid for housing subsidies instead.

The decision by a federal judge in Rhode Island was a blow to an effort to shift aid away from housing subsidies in favor of treatment for mental illness and addiction.

The Trump administration's battle to transform homelessness policy suffered a new setback on Friday when a federal judge blocked its latest effort to shift funding from housing aid to programs that require treatment for mental health or addiction.

The ruling came shortly before the administration was set to announce thousands of grants to nonprofit groups, and barred it from steering much of the annual funding to the treatment-centered efforts it favors. Since the treatment money would have come from existing housing programs, critics said large numbers of formerly homeless people risked being evicted.

The ruling is the third time that Mary S. McElroy, a federal judge in Rhode Island, has blocked the government's efforts to rewrite grant-making rules that control billions of dollars in annual aid. In reserving about a third of the funding, $1.3 billion, for treatment programs, the administration "exceeded its statutory authority," she wrote.

With current funding about to expire and service providers awaiting decisions, Judge McElroy gave the Department of Housing and Urban Development just five days to submit a new plan for disbursing the aid.

Ann Oliva, the chief executive officer of the National Alliance to End Homelessness, one of the groups that sued the administration, estimated that 97,000 formerly homeless people could have returned to the streets if the housing money had been redirected to treatment programs.

"On behalf of communities across the nation working to address homelessness, we applaud this decision," she said. "The core of this fight is about the effectiveness of permanent supportive housing. Safe and affordable housing ends people's homelessness."