San Diego County filed suit Friday in Superior Court, asking that the state be ordered to pay the costs if a judge prohibits the county from ending its County Medical Services program.

The action was a response to Monday’s lawsuit by the Legal Aid Society of San Diego on behalf of uninsured, working poor and other medically indigent people who would lose access to regular medical care if the program shuts down.

The County Board of Supervisors has voted to close the program Tuesday because of a lack of funding. Judge Harrison Hollywood is scheduled to hear arguments for a preliminary injunction against the shutdown at 4 p.m. Monday.