The 91-year-old Duke of Edinburgh was discharged from the Aberdeen Royal Infirmary Monday morning.
He shook hands with staff outside the hospital before climbing into a waiting car.
"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."
- Will Prince Philip's illness speed up changes in the House of Windsor?
Buckingham Palace said he would return to the nearby Balmoral estate, where the Royal Family is on vacation. It was his third hospital stay in the past eight months.
The prince was admitted last Wednesday for a recurrence of an infection that sent him to hospital in June and forced him to miss some of the events of the Queen's Diamond Jubilee celebration.
He also spent four nights in hospital over Christmas after suffering chest pains. He underwent a coronary stent procedure to clear a blocked artery.
The prince is scheduled to attend the opening of the Paralympic Games with the Queen on Aug. 29. It's not known if he'll be able to make that.
Philip, a former naval officer, married the Queen in 1947. For the most part, his health remained robust but he has appeared more frail in recent years.