Britain's Prince Philip left a Scottish hospital on Monday (local time) after five days of treatment for a bladder infection.
The 91-year-old husband of Queen Elizabeth II was hospitalized on Wednesday with a recurrence of an infection he suffered earlier this summer.
Buckingham Palace said Philip was discharged from Aberdeen Royal Infirmary in northeast Scotland was returning to the nearby Balmoral estate, where the royal family is on vacation.
The prince, also known as the Duke of Edinburgh, looked relaxed as he shook hands with staff outside the hospital before getting into a waiting Range Rover.
"The duke was a very good patient," said senior staff nurse Denise Webster, "and as he left the hospital he told staff to behave themselves and he said he was going back to enjoy the rest of his holiday."
It was Philip's third hospital stay in the last eight months. He was hospitalized for five days in June with a bladder infection that may have been aggravated by his appearance at a flotilla marking the queen's 60-year reign.
In December, he underwent a successful coronary stent procedure to clear a blocked artery.
Philip is a former naval officer who married the queen in 1947. His health remained robust through his 80s, but he has appeared frailer in recent years.
When he turned 90, he said he was "winding down," and he has cut back on official duties. But he still carries out some engagements, both with his wife and on his own.
Philip resumed royal duties after recovering from his bladder infection in June, attending the opening ceremony of the Olympics on July 27, watching his granddaughter Zara Phillips take part in Olympic equestrian competition two days later and carrying out engagements until last week. He has looked well at recent events despite his advancing years.
There was no immediate word on whether he would attend the opening ceremony of the Paralympic Games on August 29 alongside the queen.