Prince Philip, Duke of Edinburgh, has been discharged from hospital after receiving treatment for a bladder infection.
Prince Philip, 91, spent five nights at the Aberdeen Royal Infirmary – his third hospital stay in nine months.
The duke was taken to hospital on Wednesday during the royals’ annual summer break at Balmoral in Aberdeenshire.
It is not yet known if he will be fit to attend the Paralympics opening ceremony with the Queen on 29 August.
It was a low-key exit and he looked extremely relaxed, shaking hands with the doctors and nurses involved in treating him.
Denise Webster, a senior staff nurse, told reporters: “The duke was a very good patient, 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.”
Prince Philip has now rejoined the rest of the Royal Family at Balmoral.
Buckingham Palace had described his admission to hospital as a “precautionary measure” after the recurrence of an infection he suffered shortly before the Diamond Jubilee concert on 4 June.
The duke missed the Royal Family’s visit to morning service at Crathie Kirk on Sunday, before spending a fifth night at the NHS hospital, where he was seen by private physicians.
Doctors told the duke to rest and he did not receive any visitors during his latest stay in hospital, however his family are said to have been in contact by phone.
In June, the duke spent five nights in hospital with a bladder infection following the Diamond Jubilee Pageant on the River Thames.
He missed some of the key celebrations for the Queen’s 60-year reign, including the star-studded Jubilee concert.
Prince Philip, who is the longest-serving royal consort in British royalty, also spent four nights in hospital over Christmas following an operation to clear a blocked heart artery.
In March, Prince Harry said the operation – which was successful – had given his grandfather a “new spurt of life”.
The duke went to Balmoral after attending several Olympic events, including the opening ceremony, and he also saw his granddaughter Zara Phillips’ Olympic equestrian debut.
Last week Prince Philip was said to be in good spirits when he took part in events as part of Cowes Week on the Isle of Wight.