Officials in San Francisco and Santa Clara County launched another legal battle against the Trump administration Tuesday, challenging a new rule that will give the federal government authority to deny entry or green cards to legal immigrants who use — or are likely to use — public assistance programs.

The rule could drastically alter the landscape of legal immigration to the United States, shifting it away from a system focused on family unification and toward one that prioritizes merit and skill.

Under the Department of Homeland Security’s “Inadmissibility on Public Charge Grounds,” or “public charge” rule, use of certain government benefits, such as Medicaid, federal housing assistance or food stamps are grounds to deny an immigrant permanent legal residency or entry to the United States.

Immigration officers will also weigh education, household income and health to determine whether to grant immigrants legal status. It’s the latest attempt by the Trump administration to curb legal immigration by targeting poor people with limited resources deemed likely to pose a financial burden on American tax-payers.

Critics say the rule, in the works since last year, has stoked significant fear among immigrants — even those who wouldn’t be affected by the policy, such as U.S. citizens. Public health officials say many have stopped using public benefits altogether.

The policy, announced Monday, goes into effect in October. Santa Clara County Counsel James R. Williams and San Francisco City Attorney Dennis Herrera filed a joint lawsuit in U.S. District court Tuesday, asking a judge to block the policy.

“It makes it easier to unfairly target hard-working, lawful immigrants while sowing fear and confusion in our communities,” Herrera said in a statement. “This rule forces people to make an impossible choice: their health or a better future for their family.”

Williams called the rule a “foolish attack on immigrant communities.”

“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,” Williams said in a statement.

The lawsuit says the new rule rejects the “longstanding, existing definition of public charge” and attempts to redefine it by considering even minimal use of a wide array of non-cash benefits.

“It also expands the factors considered in public charge determinations by adding elements such as family size, credit score, and a noncitizen’s mere application for benefits, each of which has a dubious relationship to the public charge inquiry,” the lawsuit said.

“This abrupt shift in policy undermines the counties’ critical public health and safety-net systems, is arbitrary and capricious, flouts federal law, and seeks to usurp Congress’ authority by administratively repealing its longstanding family-based immigration system.”

U.S. Citizenship and Immigration Services, which is part of the Department of Homeland Security, said it does not comment on pending litigation.

Acting director of Citizenship and Immigration Services Ken Cuccinelli announced the regulation change Monday and said it fits the president’s message on immigration.

“We want to see people coming to this country who are self-sufficient,” Cuccinelli said.

Federal law already requires those seeking green cards and legal status to prove they will not be a burden to the U.S., or what’s called a “public charge,” but the new rules detail a broader range of programs that could disqualify them.

Under the new rules, the Department of Homeland Security has redefined a public charge as someone who is “more likely than not” to receive public benefits for more than 12 months within a 36-month period. If someone has two benefits, that is counted as two months.

Green card hopefuls will be required to submit three years of federal tax returns in addition to a history of employment. If immigrants have private health insurance, that will weigh in their favor.

Sen. Dianne Feinstein, D-Calif., on Tuesday said she supports the lawsuit.

“The public charge rule turns our back on the immigration story that’s been the fabric of our nation for centuries by denying green cards to immigrants working legally within the law,” Feinstein said in a statement.

San Francisco and Santa Clara County filed a joint lawsuit against the administration in 2017 challenging an executive order by the president to withhold federal grants from sanctuary jurisdictions. The Ninth U.S. Circuit Court of Appeals in San Francisco last year ruled Trump had acted unconstitutionally in his order.

The Associated Press contributed to this report.

Tatiana Sanchez is a San Francisco Chronicle staff writer. Email: tatiana.sanchez@sfchronicle.com Twitter: @TatianaYSanchez