A Riverside County judge overturned California’s physician-assisted suicide law on Tuesday, giving the state attorney general five days to file an appeal to keep the law in place.

California’s law, which allows terminally ill patients to request lethal medications from their doctors, has been the subject of a fierce and emotional debate since it was approved in 2015. The state was the fifth in the nation to legalize the practice.

Superior Court Judge Daniel A. Ottolia said Tuesday that the California Legislature violated the law by passing the End of Life Option Act during a special session dedicated to healthcare issues, according to the plaintiffs in the case as well as advocates for the law.

“We’re very happy with the decision today,” said Alexandra Snyder, head of the Life Legal Defense Foundation, one of the groups that filed the lawsuit. “We will now wait and see what the attorney general does.”

In a statement emailed to The Times, California Atty. Gen. Xavier Becerra said: “We strongly disagree with this ruling and the state is seeking expedited review in the Court of Appeal.”

California’s law allows patients with less than six months to live to request end-of-life drugs from their doctors, a practice that has been allowed in Oregon for more than 20 years. Now, nearly 1 in 5 Americans live in a state where physician-assisted suicide is legal, according to advocacy group Compassion and Choices.

In the first six months California’s law was in effect, more than 100 people made use of it to end their lives. Fifty-nine percent of them had cancer, according to state data.

John C. Kappos, an attorney representing Compassion and Choices, which advocated for the law, said he believes the passage of the law was constitutional because aid in dying is a healthcare issue.

“Ultimately, we are confident an appeals court will rule the Legislature duly passed the End of Life Option Act and reinstate this perfectly valid law, which the strong majority of Californians support,” he said in a statement.

He cited a 2015 survey conducted by UC Berkeley that found that 76% of Californians supported allowing terminally ill patients to take their own lives.

Harry Nelson, a healthcare attorney in Los Angeles, said he thinks it’s unlikely the law will be overturned permanently. He said that even if the court’s decision stands, the Legislature would probably be able to reinstate the law with whatever changes the court deems necessary.

“I think this is a short-term victory for people who object on religious principles to the availability of this option,” said Nelson, who represents several doctors who have written prescriptions under the law.

He said Ottolia’s decision to give Becerra five days to file an emergency appeal was “aggressive.”

“It basically leaves the attorney general’s office with a really narrow window to do everything they need to do to get the court of appeals to intervene and uphold and continue the law,” he said.

The push for physician-assisted suicide in California came after Brittany Maynard, a 29-year-old Californian with brain cancer, moved to Oregon to take advantage of its end-of-life law.

When Gov. Jerry Brown signed the law, he said he was unsure what he would want in such a situation but imagined “it would be a comfort to be able to consider the options afforded by this bill. And I wouldn’t deny that right to others.”

Dan Diaz, Maynard’s husband, who advocated for the law on her behalf, said in a statement that he would “once again focus all my efforts to convince Gov. Brown, the attorney general and the courts to keep this law in effect.”

Writing the lethal prescriptions is voluntary for doctors and medical facilities in California, and some, including all Catholic and church-affiliated hospitals, have not allowed their physicians to prescribe such medicines. California’s data from the law’s first six months show that 173 physicians wrote the 191 prescriptions statewide.

The suit was originally filed on the day the law took effect two years ago. That day, a judge denied a temporary restraining order that would have stopped the law from being enacted.

“This ruling affirms that assisted suicide advocates circumvented the legislative process,” Matt Valliere, executive director of the New York-based Patients Rights Action Fund, which opposes legalizing physician-assisted suicide, said in a statement. “It represents a tremendous blow to the assisted suicide legalization movement and puts state legislatures on notice regarding the political trickery of groups like Compassion and Choices.”

Ottolia read his ruling in court Tuesday morning and will not release the written document for five days, said David Gutknecht, deputy executive officer of administration for the Riverside County’s Superior Court. Court logs confirm that the judge granted a motion Tuesday morning.

Matt Fairchild, who has skin cancer that has spread to his brain, said he hoped the law is not ultimately overturned. He does not qualify for the law because doctors estimate he has more than six months to live, but he said he wants the option if his condition worsens.

“It’s something that I want in my toolbox,” said Fairchild, 48, of Burbank.

He said it seemed unfair that a court could make such a big decision for someone who is sick, and perhaps suffering. “It’s going to affect the way a person in California takes their last breath,” Fairchild said.

CAPTION

Los Angeles Times sports writer Andy McCullough and columnist Bill Plaschke discuss the second half of the Dodgers' season and if they can make it to the World Series by just hitting.

Los Angeles Times sports writer Andy McCullough and columnist Bill Plaschke discuss the second half of the Dodgers' season and if they can make it to the World Series by just hitting.

CAPTION

Los Angeles Times sports writer Andy McCullough and columnist Bill Plaschke discuss the second half of the Dodgers' season and if they can make it to the World Series by just hitting.

Los Angeles Times sports writer Andy McCullough and columnist Bill Plaschke discuss the second half of the Dodgers' season and if they can make it to the World Series by just hitting.

CAPTION

The erratic conflagration has chewed through more than 273,000 acres and 68 homes in 10 days, making it the second-largest wildfire on record in California.

The erratic conflagration has chewed through more than 273,000 acres and 68 homes in 10 days, making it the second-largest wildfire on record in California.

CAPTION

Firefighters are battling 17 wildfires across the state, which have consumed more than 200,000 acres combined in terrain stretching from Southern California to the Oregon border

Firefighters are battling 17 wildfires across the state, which have consumed more than 200,000 acres combined in terrain stretching from Southern California to the Oregon border

CAPTION

More than a dozen people reported missing, 500 structures destroyed.

More than a dozen people reported missing, 500 structures destroyed.

CAPTION

A duck boat that sank in southern Missouri, killing 17 people aboard, has been raised.

A duck boat that sank in southern Missouri, killing 17 people aboard, has been raised.