A California judge dismissed a lawsuit Monday challenging a law banning physician-assisted suicide for the terminally ill. Efforts to legalize physician-assisted suicide also failed in the California state legislature. Above, the Capitol building in Sacramento. Creative Commons/David Sawyer

A judge in San Diego dismissed a lawsuit Monday in which plaintiffs challenged a California law banning physician-assisted suicide. The plaintiffs, who argued the question of how patients who wish to end their own lives with the help of their doctors -- also known as "right-to-die" -- can be legally allowed to do so should be taken up by the legislature, were expected to appeal the decision, NBC San Diego reported.

Christy O’Donnell, 47, a cancer patient and the lead plaintiff in the case, had sought to obtain the legal right to end her life because, in part, many common painkillers, including morphine, have not worked for her. Another plaintiff, Elizabeth Wallner, 51, was afflicted with Stage IV colon cancer that has metastasized and reached her liver and her lungs.

Section 401 of California’s Penal Code has banned terminally ill patients from ending their own lives with the help of a doctor. It reads, in full, “Every person who deliberately aids, or advises, or encourages another to commit suicide, is guilty of a felony.”

Recently proposed legislation that would have allowed patients with terminal illnesses to end their own lives did not make it past California’s Assembly Health Committee. Many of the committee's members hailed from districts with large Catholic constituencies, the Associated Press reported. In California, the Catholic Church has been one of the most vocal opponents of right-to-die legislation, which advocates have often described as death with dignity. Another right-to-die bill also failed to pass the Senate in July.

Amid the controversy, San Diego Superior Court Judge Gregory Pollack declared that any allowances for physician-assisted suicide were the task of California's legislature, not its courts.

"To the extent that Penal Code 401 unfairly blocks the wishes of certain persons affected by it, rather than this court nixing the law as unconstitutional, the legislature ought to be fixing the law so that the legitimate needs of terminally ill patients and their physicians are recognized, respected and protected," Judge Pollack wrote, according to NBC San Diego.

Pollack’s ruling Monday confirmed what he had indicated Friday: that he planned to dismiss the case on these very grounds. “You're asking this court to make a new law,” he said last week. "If a new law is made, it should be by the Legislature or by a ballot initiative.”

Still, 70 percent of Californians support physician-assisted suicide, the Los Angeles Times reported in January. The topic drew significant attention with the case of Brittany Maynard, a 29-year-old who learned in the spring of 2014 that she had terminal brain cancer. She and her family moved from California to Oregon, where it would be legal for her to end her life when she chose. She did so on Nov. 1, 2014.

The plaintiffs in the lawsuit said Friday they planned to appeal if the judge dismissed their case. Terminally ill adults such as O’Donnell faced “horrific suffering at the end of their lives that no medication can alleviate" and thus needed "to have the option of medical aid in dying,” John Kappos, O’Donnell’s attorney, said in a statement, Modern Healthcare reported.

Physician-assisted suicide has been legalized in five U.S. states: Oregon, Washington, Vermont, Montana and New Mexico. The decision of whether to allow physician-assisted suicide was left to the states after the U.S. Supreme Court ruled in 1997 that the Constitution did not guarantee the right to aid in dying.