LONDON — During the last months of her life, a terminally ill 14-year-old British girl made a final wish. Instead of being buried, she asked to be frozen so that she could be “woken up” in the future when a cure was found — even if that was hundreds of years later.

“I want to have this chance,” the teenager wrote in a letter to a judge asking that she be cryogenically preserved. She died on Oct. 17 from a rare form of cancer. “I don’t want to be buried underground,” she wrote.

The girl’s parents, who are divorced, disagreed about the procedure. The teenager had asked the court to designate that her mother, who supported her daughter’s wishes, should decide how to handle her remains.

The judge, Peter Jackson, ruled in her favor. Local news reports said he was impressed by the “valiant way in which she was facing her predicament.” He said she had chosen the most basic preservation option, which costs about £37,000, or nearly $46,000, an amount reportedly raised by her grandparents.