A U.S. judge ruled Wednesday that the government does not have to immediately resume paying "Obamacare" health care subsidies that President Donald Trump cut off.

Eighteen state attorneys general, led by California Democrat Xavier Becerra, argued the monthly payments are required under former President Barack Obama's health care law and cutting them off will harm consumers.

U.S. District Judge Vince Chhabria in San Francisco said the Trump administration had the "stronger legal argument" and the emergency relief sought by the states would be "counterproductive" since they had devised workarounds to the lost subsidies that give millions of lower-income people better health care options. The states had asked him to force the government to keep making the payments while the case works its way through the courts, which will take months.

The Trump administration had announced earlier this month that it will cut off cost-sharing reduction payments, which aim to reduce out-of-pocket costs for lower-income people.

Trump has said Obama's law is imploding and has criticized the subsidies as insurance company bailouts. The White House says the government cannot legally continue paying the subsidies because there is no formal authorization from Congress.

Chhabria, an Obama appointee, said at a hearing Monday that California and other states had protected consumers from the loss of the funding so people didn't face an immediate threat of higher insurance costs.

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

Chhabria peppered an attorney for California with questions about why he should force the administration to resume payments when the states had devised a workaround that would benefit many consumers.

"The state of California is standing on the courthouse steps denouncing the president for taking away people's health care, when the truth is that California has come up with a solution to that issue that is going to result in better health care for a lot of people," Chhabria said.

Gregory Brown, who represented California at the hearing, said the loss of the subsidies was creating "uncertainty and chaos" that could lead insurance companies to opt out of the health law.

The administration had been making the monthly payments even as Trump threatened to cut them off to force Democrats to negotiate over health care. A bipartisan effort in Congress to restore the payments has run into opposition.

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 argue that the Trump administration violated a law requiring government agencies to obey existing statutes and follow orderly and transparent procedures.

Democratic attorneys general have pushed back against Trump's agenda in the federal courts, looking to block the president's attempts to roll back Obama's policies on the environment, health care and immigration.

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.