(Bloomberg) — A new U.S. Department of Homeland Security rule to screen out immigrants deemed at risk of becoming dependent on government benefits was put on hold by judges on both coasts until there’s a final decision on whether the so-called green card wealth test is legal.

U.S. District Judge George Daniels in Manhattan called the rule “repugnant to the American Dream of the opportunity for prosperity and success through hard work and upward mobility.” In a decision issued Friday, he blocked it from taking effect nationwide. Separately, a judge in Oakland, California, prohibited the policy from being implemented in four states and the District of Columbia.

The rule — which was announced in August and was set to go into effect Oct. 15 — replaces a current policy that says immigrants shouldn’t receive more than half their income from cash benefits, such as Temporary Assistance for Needy Families or Supplemental Security Income from Social Security.

Under the new more expansive definition, immigrants aren’t supposed to use public benefits like Medicaid, public housing assistance or food stamps for more than 12 months over a 36-month period. Immigration officials will consider an immigrant’s age, health, education and wealth to see if they are at risk of becoming a “public charge.”

Immigrant rights advocacy groups and several states have argued that the new rule conflicts with existing immigration laws and would drive up the cost of providing health care and other services to immigrants.

Read more: Trump Boasted That His Border Wall Was ‘Virtually Impenetrable.’ Then an 8-Year-Old Girl Climbed a Replica

Daniels blocked the rule following an August lawsuit filed by New York, Connecticut and Vermont and the city of New York, which alleged that the policy specifically targets immigrants of color. He ruled that the Department of Homeland Security went beyond its authority under federal immigration law.

“Defendants do not articulate why they are changing the public charge definition, why this new definition is needed now, or why the definition set forth in the rule — which has absolutely no support in the history of U.S. Immigration law — is reasonable,” Daniels said.

The homeland security department didn’t immediately respond to a request for comment.

“This rule would have had devastating impacts on New Yorkers and our nation, and today’s decision is a critical step in our efforts to uphold the rule of law,” New York Attorney General Letitia James tweeted Friday.

The New York case is State of New York v. U.S. Department of Homeland Security, 19-cv-07777, U.S. District Court, Southern District of New York (Manhattan). The California case is City and County of San Francisco v. Department of Homeland Security, 3:19-cv-4717, U.S. District Court, Northern District of California (Oakland).

Contact us at letters@time.com.