Britain's Prince Philip, the 99-year-old husband of Queen Elizabeth, left a London hospital on Tuesday after a four-week stay for treatment for an infection and to have a heart procedure.
Philip, the Duke of Edinburgh, was admitted to the private King Edward VII's Hospital on Feb. 16 after he felt unwell and was given treatment for an unspecified, but not COVID-19-related, illness.
He was transferred briefly at the start of this month to a specialist cardiac centre at another London hospital, where he underwent a successful procedure for a pre-existing heart condition.
A Reuters witness said the duke left the King Edward hospital shortly after 10.30 GMT on Tuesday. He was taken to a waiting car in a wheelchair and returned to Windsor Castle, the royal residence west of London, waving to those outside as he arrived.
"His Royal Highness wishes to thank all the medical staff who looked after him at both King Edward VII's Hospital and St Bartholomew's Hospital, and everyone who has sent their good wishes," Buckingham Palace said in a statement.
A royal source said the prince was in good spirits.
Since being admitted, the duke has been publicly visited only by his eldest son Prince Charles, the heir to the throne.
The queen, 94, has remained at Windsor Castle where the couple have been staying during the coronavirus pandemic, and has continued to carry out her official duties by video.
Both she and Philip have received their first COVID-19 vaccine dose.
The Greek-born prince, who turns 100 in June, has required hospital treatment a number of times in the last decade for a recurrence of a bladder infection.
At Christmas in 2011 he had an operation to clear a blocked artery in his heart after being rushed to hospital with chest pains.
During his latest hospital stay, the royal family has been embroiled in a crisis after his and Elizabeth's grandson Prince Harry and his wife Meghan gave a televised interview to Oprah Winfrey.
During the interview, Meghan said a member of the royal family had made a racist comment while Harry criticised his relatives for failing to stand up to what he regarded as abusive press treatment of his wife.
Harry also said his father, Charles, had let him down and that he had felt trapped in his royal life.
The comments led Buckingham Palace to issue a statement on the queen's behalf saying she was saddened by what they had said, while Harry's elder brother William told reporters: "We're very much not a racist family".
Philip, who has been at the queen's side throughout her 69-year reign, has always been considered the patriarch of the royal family privately, while always deferring to his wife in public and over state affairs.
However, since he retired from public life in 2017 he has taken more of a backseat role, with Prince Charles and Prince William, both future kings, taking on greater responsibilities.
(Reporting by Toby Melville, Andy Bruce and William James, writing by Michael Holden; editing by Estelle Shirbon and Mike Collett-White)