SAN FRANCISCO (AP) — A U.S. judge on Wednesday rejected a request from 18 states and the District of Columbia to force the Trump administration to resume paying "Obamacare" subsidies right away and scolded the coalition for claiming health care costs would rise without federal help.

State attorneys general, all Democrats and led by Xavier Becerra of California, argued that the monthly payments are required under former President Barack Obama's health care law and cutting them off will harm consumers. The payments reimburse insurers for providing lower-income people with discounts on out-of-pocket costs.

U.S. District Judge Vince Chhabria, an Obama appointee, said the states had devised workarounds to the lost subsidies that would give millions of lower-income people even better health care options.

That means the emergency order the states sought would be "counterproductive," the judge said.

The states should stop "yelling about higher premiums" and "focus instead on communicating the message that they have devised a response ... that will prevent harm to the large majority of people while in fact allowing millions of lower-income people to get a better deal on health insurance in 2018," Chhabria said.

The states had asked Chhabria to order the government to keep making the payments while their lawsuit works its way through the courts, which will take months. Becerra said he will continue to press the case.

"The fight for affordable health care moves forward," he said in a statement after the ruling. "The actions by the Trump Administration undermine critical payments that keep costs of health care affordable for working families."

President Donald Trump announced earlier this month that he will cut off the payments, saying Obama's law is imploding and criticizing the subsidies as insurance company bailouts. The White House says the government cannot legally continue paying them because there is no formal authorization from Congress.

The judge said in his ruling that the Trump administration had the stronger legal argument, though he cautioned that the question of whether Congress had permanently set aside money for the subsidies was "close and complicated."

Chhabria hammered an attorney for the state of California at a hearing this week over how the change would affect consumers.

Gregory Brown, who represented California, said the decision was creating "uncertainty and chaos" that could lead insurance companies to opt out of the health law. Brown also said it would "spook consumers."

Chhabria wasn't buying the argument. He said California and other states had anticipated the subsidies would end and found a way to ensure consumers would not pay more for insurance.

The states limited the plans for which insurers could hike premiums and ensured that many people will get more tax credits for their health insurance purchases, the judge said.

In his ruling, Chhabria cited an October press release by California's health care marketplace, which said the premiums of nearly four of five consumers will stay the same or decrease after surcharges tied to the lost subsidies are factored in. The judge said dozens of other states also have accounted for the end of the subsidies.

The payments reimburse insurers for the costs of lowering copays and deductibles, which they are required to do for low-income customers who buy coverage through the health care marketplaces created by Obama's law.

The states joining California in the lawsuit are: Connecticut, Delaware, Illinois, Iowa, Kentucky, Maryland, Massachusetts, Minnesota, New Mexico, New York, North Carolina, Oregon, Pennsylvania, Rhode Island, Vermont, Virginia and Washington, along with the District of Columbia.