The Duke of Edinburgh has been discharged from hospital following a successful hip replacement operation.
Prince Philip, 96, waved as he was driven past the front entrance to King Edward VII's Hospital in London, having left through a different exit.
He was admitted to hospital on 3 April and underwent the planned procedure the following day.
The duke, who will continue his recovery in Windsor, thanked the public for their "good wishes".
In a statement, Buckingham Palace said: "His Royal Highness The Duke of Edinburgh left King Edward VII's Hospital at midday today, following a hip replacement operation last week.
"His Royal Highness would like to convey his appreciation for the messages of good wishes he has received."
Princess Anne visited her father in hospital on Thursday and described him as "on good form".
The Queen also gave an update, telling a well-wisher in Windsor who asked about Philip's recovery: "He said he's getting on very well."
The duke retired from royal duties in August 2017. His hip problem came to light after his absence from the Easter service at Windsor.
He also missed two other recent events at Windsor Castle - the Royal Maundy Service at St George's Chapel on 29 March, and a parade a week earlier to mark Prince Andrew's appointment as Colonel of the Grenadier Guards.
The duke's last solo engagement was on 2 August last year, when he reviewed a parade of Royal Marines outside Buckingham Palace in his capacity as captain general of the corps.
By BBC health and science correspondent James Gallagher
A hip replacement completely rebuilds the hip joint.
The top of the thigh bone is removed and replaced with a metal stem that has a smooth ball on the end.
Part of the pelvis is also hollowed out and fitted with a socket for the ball to move in.
Recovery will depend on the individual patient but, in general, doctors get patients on their feet as quickly as possible and discharge them three to five days after the procedure.
There will be physiotherapy exercises to do at home and crutches are needed for about four to six weeks.
Patients tend to feel back to normal after about three months.
Most hip replacements are carried out on patients between the ages of 60 and 80 but overall fitness is a bigger factor than age in any decision to operate.
Figures for the UK, excluding Scotland, show 851 people over 90 had a hip replacement in 2016.
In the 1990s, the Queen Mother underwent two successful hip operations, aged 95 and 97.