LOS ANGELES — A state appeals court has reinstated — at least for now — California's law allowing terminally ill people to end their lives.

The Fourth District Court of Appeals in Riverside issued an immediate stay Friday putting the End of Life Option back into effect. The court also gave opponents of its decision until July 2 to file objections.

The law allows adults to obtain a prescription for life-ending drugs if a doctor has determined that they have six months or less to live.

Riverside County Superior Court Judge Daniel Ottolia declared the law unconstitutional last month, stating that it had been adopted illegally because lawmakers passed it during a special legislative session called to address other matters.

Ottolia didn't address the issue of whether it's proper for people to end their lives.

Right-to-die advocates hailed Friday's action.

"This stay is a huge win for many terminally ill Californians with six months or less to live because it could take years for the courts to resolve this case," Kevin Díaz, national director of legal advocacy for Compassion & Choices, said in a statement.

"Thankfully, this ruling settles the issue for the time being, but we know we have a long fight ahead before we prevail."

California Attorney General Xavier Becerra, who had asked the appeals court to stay Ottolia's ruling, also praised the decision.

"This ruling provides some relief to California patients, their families, and doctors who have been living in uncertainty while facing difficult health decisions," Becerra said. "Today's court ruling is an important step to protect and defend the End of Life Option Act for our families across the state."

Patients Rights Action Fund, which opposes laws allowing people to take their lives, did not respond to a message placed after business hours Friday. In previously discussing the law, the group's executive director, Matt Valliere, said, "The people of California, especially the vulnerable, deserve protection and support, not assisted suicide."

The Life Legal Defense Foundation, American Academy of Medical Ethics and several physicians were among those who sued to have the law overturned.

Their lawsuit, Ahn vs. Hestrin, claims the law violates the due process and equal protection guarantees of the U.S. and California constitutions because it fails "to make rational distinctions" between terminally ill adults "and the vast majority of Californians not covered by the act."

The suit also claims the Legislature did not have authority to pass the law during a special session limited to other issues.

Becerra argued that the law, which took effect in 2016, was legitimately passed during a special legislative session dedicated to health issues.

California health officials reported that 111 terminally ill people took drugs to end their lives in the first six months after the law went into effect June 9, 2016, and made the option legal in the nation's most populous state.

Oregon was the first to provide the option in 1997. It also is allowed in Washington, Vermont, Colorado, Hawaii and Washington D.C.