TORONTO — Canada's highest court struck down a ban on doctor-assisted suicide for mentally competent patients with terminal illnesses Friday, declaring that outlawing that option deprives dying people of their dignity and autonomy.

The Supreme Court's unanimous decision reverses its own decision two decades ago and gives Parliament and provincial legislators 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 ruling immediately triggered emotional responses from both sides of the debate, and Justice Minister Peter MacKay said the conservative government will take its time to act on it.

"This is a sensitive issue for many Canadians, with deeply held beliefs on both sides. We will study the decision and ensure all perspectives on this difficult issue are heard," MacKay said.

The decision was spurred by cases brought by the families of two British Columbia women, who have since died.

In its ruling, the court quoted one of the women's wishes: "What I fear is a death that negates, as opposed to concludes, my life," Gloria Taylor said. "I do not want to die slowly, piece by piece. I do not want to waste away unconscious in a hospital bed. I do not want to die wracked with pain."

Taylor was diagnosed with amyotrophic lateral sclerosis, a degenerative neurological illness also known as Lou Gehrig's disease. She 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.

The court stated that "by leaving people like Ms. Taylor to endure intolerable suffering, it impinges on their security of person."

The decision reversed 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.

The top court said Friday that doctors are capable of assessing the competence of patients to consent, and found there is no evidence that the elderly or people with disabilities are vulnerable to being talked into ending their lives.

"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.

The other woman whose case helped spur Friday's ruling, Kay Carter, was diagnosed with a degenerative spinal cord condition. At age 89, Carter travelled to Switzerland, where assisted suicide is allowed.

Her family rejoiced at the ruling Friday.

"Justice, dignity and compassion were the defining qualities of my mother," Kay's daughter, Lee, told reporters.

Canadian law defines assisted suicide as "providing another with the knowledge or means to intentionally end his or her own life."

Assisted suicide is legal in Switzerland, Germany, Albania, Colombia, Japan and in the U.S. states of Washington, Oregon, Vermont, New Mexico and Montana. The Netherlands, Belgium and Luxembourg allow doctors, under strict conditions, to euthanize patients whose medical conditions have been judged hopeless and who are in great pain.

The Canadian Medical Association said it will seek to help draft a new law governing medical aid in dying to ensure patient needs are respected and the physician's perspective is reflected. Among issues the law should clarify is whether non-citizens would be allowed to travel to Canada to get a doctor's help to die, said Dr. Jeff Blackmer, director of ethics at CMA.

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.

Opponents of assisted suicide denounced Friday's ruling.

"Life is too precious to allow a doctor to kill," said Dr. Charles McVety, president of the Institute for Canadian Values.

Taylor Hyatt, a representative of the Euthanasia Prevention Coalition who uses a wheelchair, said the Supreme Court had abandoned the disabled.

"If a person has disabilities, there's an assumption that your life is unbearable and there's nothing good in it," Hyatt said tearfully in the court lobby.

But Linda Jarrett, a 66-year-old diagnosed with secondary progressive multiple sclerosis, said the ruling has lifted some of her anxiety about dying.

"I do not want to end my life in having a quality that's not acceptable to me," Jarrett aid. "I will be able to say to a physician: 'I'm ready to go now. I want my life to end'."