Parliament in Belgium has passed a bill allowing euthanasia for terminally ill children without any age limit, by 86 votes to 44, with 12 abstentions.
When, as expected, the bill is signed by the king, Belgium will become the first country in the world to remove any age limit on the practice.
It may be requested by terminally ill children who are in great pain and also have parental consent.
Opponents argue children cannot make such a difficult decision.
It is twelve years since Belgium legalised euthanasia for adults.
In the Netherlands, Belgium's northern neighbour, euthanasia is legal for children over the age of 12, if there is parental consent.
Conditions for child euthanasia
- Patient must be conscious of their decision
- Request must be approved by parents and medical team
- Illness must be terminal
- Patient must be in great pain with no treatment available to alleviate their distress
Under the Dutch conditions, a patient's request for euthanasia can be fulfilled by a doctor if the request is "voluntary and well-considered" and the patient is suffering unbearably, with no prospect of improvement.
One man in the public gallery of Belgium's parliament shouted "murderers" in French when the vote was passed, Reuters news agency reports.
Supporters of the legislation argue that in practice the law will affect an extremely small number of children, who would probably be in their teens, the BBC's Duncan Crawford reports from Brussels.
The law states a child would have to be terminally ill, face "unbearable physical suffering" and make repeated requests to die - before euthanasia is considered.
Parents, doctors and psychiatrists would have to agree before a decision is made.
Protesters have lobbied politicians against the changes.
Church leaders argued the law is immoral.
"The law says adolescents cannot make important decisions on economic or emotional issues, but suddenly they've become able to decide that someone should make them die," Brussels Archbishop Andre-Joseph Leonard, head of the Catholic Church in Belgium, said at a prayer vigil last week.
Some paediatricians have warned vulnerable children could be put at risk and have questioned whether a child can really be expected to make such a difficult choice.
Last week 160 Belgian paediatricians signed an open letter against the law, claiming that there was no urgent need for it and that modern medicine is capable of alleviating pain.
But opinion polls have suggested broad support for the changes in Belgium, which is mostly Catholic.
Would you support such a law?