RIVERSIDE, Calif. — A judge on Friday allowed a legal challenge to proceed against California's law letting terminally ill patients seek prescriptions for life-ending drugs.

Riverside County Superior Court Judge Daniel A. Ottolia ruled that a group of doctors had provided sufficient information for a lawsuit over the 2016 law allowing medically-assisted death.

California's Attorney General Xavier Becerra had argued that the suit should be dismissed because doctors aren't bound to issue these prescriptions and the law merely offers patients a choice. But Ottolia found that the plaintiffs had alleged enough information to argue that the law violates the state's constitution by treating terminally ill people distinctly from others contemplating taking their lives.

"This is a violation of both the equal protection and due process clause of the constitution," plaintiffs' attorney Stephen Larson told reporters after the ruling.

California is one of a number of states where terminally ill patients can get prescriptions to take life-ending drugs, along with Oregon, Washington, Vermont and Montana.

The law took effect in California in June 2016. It was approved a year earlier but couldn't take effect until the conclusion of a special session on health care.

To take advantage of the law, patients must be given six months or less to live, make two verbal requests at least 15 days apart and submit a written request.

During a hearing in Riverside, Deputy Attorney General Kathleen Lynch argued that the law has many safeguards and the plaintiffs — which include doctors and the American Academy of Medical Ethnics — were making allegations based on hypothetical situations.

"This Act takes nothing from anybody," she told the court. "It gives terminally ill people a right."

A trial setting conference was scheduled for Oct. 20.

The law passed following the heavily publicized case of a 29-year-old California woman with brain cancer who moved to Oregon to legally end her life in 2014.