Canada's Supreme Court has ruled that doctors may help patients who have severe and incurable medical conditions to die, overturning a 1993 ban.
In a unanimous decision, the court said the law impinged on Canadians' rights.
The case was brought by a civil rights group on behalf of two women, Kay Carter and Gloria Taylor, with degenerative diseases. Both have since died.
The government now has a year to rewrite its law on assisted suicide.
If it does not, the current law will be struck down.
Assisted suicide is legal in several European countries and a few US states.
In Canada is it illegal to counsel, aid or abet a suicide, and the offence carries up to 14 years in prison.
James Gallagher, BBC Health editor
Canada is not alone in grappling with the thorny issue of dying laws.
The debate was reignited in the United States last year by campaigner Brittany Maynard.
The 29-year-old was forced to travel from California, where the practice is illegal, to the Oregon where it has been legal since 1997. A legal case is now taking place in New York.
Some politicians in the UK are trying to introduce similar rules, but the government does not back it.
Switzerland allows "assisted suicide". This does not require a terminal illness, but must be performed by a patient and has led to "suicide-tourism" across Europe.
There is a profound gulf between those who think assisted dying is a fundamental human right and those who have ethical objections and worry about the implications for the disabled and vulnerable.
There are no easy answers.
"This is one incredible day," said Grace Pastine of British Columbia Civil Liberties Association, which brought the case.
"Physician-assisted dying is now recognised for what it is - a medical service that brings an end, for some individuals, to unbearable suffering."
In the ruling, the justices wrote they "did not agree that the existential formulation of the right to life requires an absolute prohibition on assistance in dying, or that individuals cannot 'waive' their right to life".
The court limited doctor-assisted suicide to patients who are consenting adults, who have a incurable but not necessarily terminal disease that causes "enduring and intolerable suffering".
The justices also argued the total ban on doctor-assisted suicide "deprives some individuals of life, as it has the effect of forcing some individuals to take their own lives prematurely, for fear that they would be incapable of doing so when they reached the point where suffering was intolerable".
Dropping the ban was opposed by religious groups in Canada and the issue has divided the disability-rights community in the country.
Lawyers for Kay Carter and Gloria Taylor had argued that the ban discriminated against them, as they could not take their own life without the help of their doctors.
Taylor, who had Amyotrophic Lateral Sclerosis, died in 2012.
Carter had spinal stenosis, a progressive compression of the spinal cord. She travelled with her family to Switzerland in 2010 to end her life.