Mr. Fletcher, who previously introduced a bill to allow assisted suicide, declined to speculate on the government’s next steps. His draft legislation was not formally supported by the government, making its chances of approval remote.

The two women from British Columbia whose legal cases led to the court’s decision did not live to hear the verdict. Five years ago, one of those women, Kay Carter, who was suffering from a degenerative condition known as spinal stenosis, was taken to Switzerland, where assisted deaths are legal, to die. At the court, Lee Carter, her daughter, said the decision was “a huge victory for Canadians and a legacy for Kay.” The other woman whose case led to the decision, Gloria Taylor, died from amyotrophic lateral sclerosis, commonly known as Lou Gehrig’s disease, in 2012.

As is the Supreme Court’s custom in a significant unanimous decision, the authorship of the ruling was attributed to “The Court” rather than to an individual justice.

Dr. Chris Simpson, the president of the medical association, said in a statement that his organization would work with governments to ensure that doctors would not be required to assist in patients’ deaths because of the ruling.

“The C.M.A. supports physicians being able to follow their conscience in choosing whether to participate in medical aid in dying, and we note that the court quoted directed from our policy,” Dr. Simpson said in the statement.

In 1993, the court upheld the laws against physician-assisted death in a case brought in British Columbia by Sue Rodriguez, who had Lou Gehrig’s disease. Despite that ruling, a physician, who has never been publicly identified, and a member of Parliament were present when Ms. Rodriguez killed herself a year later.

In that decision, the court said that it feared that legalized assisted suicide could be abused at the expense of weak and vulnerable people. The decision Friday, however, suggested that the legal and medical systems had evolved to the point where a complete ban was not needed.

“We agree with the trial judge that the risks associated with physician-assisted death can be limited through a carefully designed and monitored system of safeguards,” the court wrote.