Britain's Prince Philip, 96, the husband of Queen Elizabeth II, left hospital on Friday after a hip replacement operation, waving to media waiting outside the hospital as he was driven away.
Philip, the Duke of Edinburgh, was admitted last week to the King Edward VII Hospital in London which is regularly used by the royal family.
Former naval officer Philip retired from public life last August, quipping at the time that he was no longer able to "stand up much".
"His Royal Highness The Duke of Edinburgh left King Edward VII's Hospital at midday today, following a hip replacement operation last week. The Duke will continue his recovery at Windsor," Buckingham Palace said in a statement.
"His Royal Highness would like to convey his appreciation for the messages of good wishes he has received," it added.
Buckingham Palace said last week that the operation was successful and the duke was "comfortable and in good spirits".
Daughter Princess Anne was the only member of the family seen visiting the royal patriarch in hospital.
Prince Philip was forced to miss Easter religious services due to the problem with his hip and has had various health complaints in recent years.
His grandson Prince Harry's wedding to U.S. actress Meghan Markle on May 19 is likely to be his first public appearance after his operation.
Born a prince of Greece and Denmark, he married then princess Elizabeth on November 20, 1947 at Westminster Abbey in London.
On their golden wedding anniversary in 1997, she said of him: "He has, quite simply, been my strength and stay all these years."