TORONTO — Canada’s highest court unanimously struck down a ban on doctor-assisted suicide for mentally competent patients with terminal illnesses, declaring on Friday that “an individual’s response to a grievous and irremediable medical condition is a matter critical to their dignity and autonomy.”

The Supreme Court’s decision reverses its own decision two decades ago and gives Parliament a year to draft new legislation that recognizes the right of consenting adults who are enduring intolerable suffering to seek medical help ending their lives. The current ban on doctor-assisted suicide stands until then.

The judgment said the ban infringes on the life, liberty and security of individuals under Canada’s constitution. It had been illegal in Canada to counsel, aid or abet a suicide, an offense carrying a maximum prison sentence of 14 years

“The law allows people in this situation to request palliative sedation, refuse artificial nutrition and hydration, or request the removal of life-sustaining medical equipment, but denies the right to request a physician’s assistance in dying,” the ruling noted.

Assisted suicide is legal in Switzerland, Germany, Albania, Colombia, Japan and in the U.S. states of Washington, Oregon, Vermont, New Mexico and Montana. Euthanasia is currently legal in the Netherlands, Belgium and Luxembourg.

Friday’s decision reverses a Canadian Supreme Court ruling in 1993. At the time, the justices were primarily concerned that vulnerable people could not be properly protected under physician-assisted suicide.

“For seriously and incurably ill Canadians, the brave people who worked side by side with us for so many years on this case — this decision will mean everything to them,” said a visibly overjoyed Grace Pastine, the litigation director for the British Columbia Civil Liberties Association.

The pressure will now be on Parliament to act in an election year, as the court says no exemptions may be granted for those seeking to end their lives during the 12-month suspension of the judgment.

Friday’s decision was spurred by the families of two now-dead British Columbia women, supported by Pastine’s organization.

Gloria Taylor was diagnosed with Lou Gehrig’s disease, a degenerative neurological illness. Kay Carter was diagnosed with a degenerative spinal cord condition. At age 89, Carter travelled to Switzerland, where assisted suicide is allowed.

Taylor had won a constitutional exemption at a lower court for a medically assisted death in 2012, but that decision was overturned in subsequent appeals. She died of an infection later the same year.

It has been more than 20 years since the case of another patient with Lou Gehrig’s disease, Sue Rodriguez, gripped Canada as she fought for the right to assisted suicide. She lost her appeal but took her own life with the help of an anonymous doctor in 1994, at the age of 44.