(CNN) Doctors in the Netherlands may legally euthanize patients with severe dementia who previously provided a written request for the procedure, the country's highest court ruled Tuesday.

In the landmark decision, the court said that a physician may respond to a written request for euthanasia made before someone develops advanced dementia, provided certain legal requirements are met -- even if the patient's condition means they become unable to confirm that request.

Euthanasia is legal in the Netherlands if the relevant criteria are met, which include a voluntary and well-considered request from the patient, "unbearable suffering without any prospect of improvement," and the lack of a "reasonable alternative," according to the Royal Dutch Medical Association.

If those conditions are not met, the practice is still a punishable offense.

In 2002, the Netherlands became the first country in the world to legalize euthanasia.

Read More