Prince Philip, who has spent four nights in the King Edward VII's Hospital in central London for treatment relating to a "pre-existing condition", left at 8.49am on Christmas Eve after he was discharged by his doctor.A Buckingham Palace spokesman said: "His Royal Highness would like to thank everyone who sent their good wishes."
Philip got into a car in a secluded street behind the hospital and was seen sitting in the front passenger seat.
Philip waved at a nurse as he was escorted to the car but did not respond to photographers as he was driven away from the private hospital.
Multiple police stood guard around the hospital, as well as royal protection officers.
The duke was driven to Sandringham to spend Christmas with the Queen.
Philip's return to Sandringham will have added significance for his family because while most people open their presents on Christmas Day, the royal family still keep to the German practice of unwrapping their gifts on Christmas Eve.
Traditionally the Queen, duke and other royals congregate in the White Drawing Room at Sandringham House around a 20ft tree, cut from the estate, for the exchange of presents displayed nearby on a white linen-covered trestle table.
Having Philip back at Sandringham will give the occasion real importance for the royals who have endured a "bumpy" year as the Queen will say in her Christmas Day broadcast.
The family attends the morning service at the Church of St Mary Magdalene on the royal estate and greet well-wishers, although Philip is thought unlikely to attend as he missed the service last year despite being said to be in good health.
His planned admittance on Friday, to the central London private hospital which has been treating members of the royal family for decades, was described as a "precautionary measure" by Buckingham Palace.
Asked about the 98-year-old's health, his eldest son the Prince of Wales told reporters on Monday: "He's being looked after very well in hospital.
"At the moment that's all we know."
During the visit to flood-hit communities in South Yorkshire, Charles added: "When you get to that age things don't work so well."
The duke, who turned 98 in June, has generally enjoyed good health, appearing to recover well from a planned hip replacement operation in April 2018.
According to reports, his admission follows a spell of ill health - the Sun quoted a royal source saying the duke had a fall recently, while the Mail reported he had been battling a flu-like condition.
Philip escaped with minor injuries after a dramatic car crash near Sandringham in January, but in the past decade has been admitted to hospital for abdominal surgery, bladder infections and a blocked coronary artery.
Philip is known for his "no fuss" approach and is unlikely to have received many visitors while he was being treated at the hospital.
Buckingham Palace would not go into details about Philip's pre-existing condition, or the nature of his treatment.
Philip's decision to retire from public duties during 2017 was not health-related, Buckingham Palace said at the time of the announcement.