San Francisco and Santa Clara Counties announced Tuesday that they had sued the Trump administration over a new regulation that would give federal officials more power to deny green cards to immigrants deemed likely to rely on welfare, calling it an unlawful attack on immigrant communities.

“This illegal rule is just another attempt to vilify immigrants,” San Francisco City Attorney Dennis Herrera said in a statement announcing the suit. “It makes it easier to unfairly target hard-working, lawful immigrants while sowing fear and confusion in our communities.”

TRUMP ADMINISTRATION BOOSTS ABILITY TO DENY GREEN CARDS TO IMMIGRANTS USING WELFARE PROGRAMS

“The Trump administration’s new rule is an unlawful, foolish attack on immigrant communities,” Santa Clara County Counsel James R. Williams said. “It will hurt all members of our communities by reducing access to critical health and safety-net services that create healthier communities for all of our residents."

The California jurisdictions claim the rule attempts to abolish decades of legal precedent and “coerces individuals to forgo or withdraw from critical benefits or care.”

The administration announced the so-called “public charge” rule on Monday. White House officials say the change will better define and expand the factors that can be considered to deny attempts by immigrants to adjust their status. It defines a “public charge” as an immigrant who receives one or more designated public benefits for more than 12 months within a 36-month period.

Those benefits include Supplemental Security Income (SSI), Temporary Assistance for Needy Families (TANF), most forms of Medicaid and the Supplemental Nutrition Assistance Program (SNAP), widely known as food stamps. The rule expands the number of benefits that can be considered from interim guidance issued in 1999.

In an interview with Fox News, U.S. Citizenship and Immigration Services (USCIS) Acting Director Ken Cuccinelli said the change was based on “an old American value, and that’s self-sufficiency.”

“It will also have the long-term benefit of protecting taxpayers by ensuring people who are immigrating to this country don’t become public burdens, that they can stand on their own two feet, as immigrants in years past have done,” he said. “It’s not only a recipe for their success, but for America’s success growing out of our immigration system.”

But Democrats and migrant groups immediately blasted the rule as cruel and warned it could prevent migrants from receiving the benefits they need. Sen. Kamala Harris, D-Calif., called it “indefensible.”

CUCCINELLI: NEW TRUMP GREEN CARD RULE SIMPLY GIVES 'MEANINGFUL EFFECT' TO 140-YEAR-OLD DIRECTIVE

“No family should live in fear of feeding, housing, or caring for their kids,” she said.

While the Trump administration has said the change will give taxpayers better value for money for taxpayers, the California counties claim that it would actually cost taxpayers more.

“This rule forces people to make an impossible choice: their health or a better future for their family. We will all bear the cost of this misguided policy, which will shift millions of dollars in health care costs onto the taxpayers of San Francisco and Santa Clara Counties,” Herrera said. “At the same time, it will siphon millions from our local economies and drive more people toward homelessness.

CLICK HERE TO GET THE FOX NEWS APP

“This rule is rubbish. We’re determined to see that it ends up in the legal garbage bin with the rest of this administration’s unlawful policies,” he said.

A legal fight was widely expected and could potentially delay the rule’s planned implementation on Oct. 15. On Tuesday, Trump shrugged off the criticism and said his administration was doing the right thing.

“I am tired of seeing our taxpayers paying for people to come into our country and immediately go on welfare and other things, so I think we’re doing it right," he said.