Prince Philip has returned to Windsor Castle in Berkshire after his longest hospital stay following a successful heart procedure.
A Buckingham Palace spokesperson said: "The Duke of Edinburgh has today been discharged from King Edward VII's Hospital and has returned to Windsor Castle, following treatment for an infection and a successful procedure for a pre-existing condition.
"His Royal Highness wishes to thank all the medical staff who looked after him at both King Edward VII's Hospital and St Bartholomew's Hospital, and everyone who has sent their good wishes."
Prince Charles said he is "thrilled" his father is out of hospital, telling reporters on a visit to Finsbury Park mosque in London he has "spoken to him several times" since he was discharged.
Earlier, police had blocked vehicle access to King Edward VII's Hospital, where the Duke of Edinburgh had been recovering from a heart procedure.
Four police officers had arrived on motorcycles to join a dozen officers at the entrance of the private hospital in central London.
The duke, the nation's longest-serving consort who turns 100 in June, left the hospital in the back of a black BMW on Tuesday morning.
Prince Philip was first admitted to hospital on 16 February before moving to St Bartholomew's Hospital two weeks later, where he underwent a procedure for a pre-existing heart condition.
He was moved back to King Edward VII's Hospital days later.
The duke spent 28 nights in hospital as an in-patient - his longest ever stay.
The exact reason for his initial admission was not disclosed, but it was not related to coronavirus.
He was visited by his eldest son Charles, the Prince of Wales, who made a 200-mile round trip to see his father last month and stayed for around 30 minutes.
Prince Philip has been treated for heart problems in the past.
In 2011, the duke was rushed to hospital by helicopter from Sandringham after suffering chest pains as the Royal Family was preparing for Christmas.
On that occasion he was treated for a blocked coronary artery at Papworth Hospital in Cambridgeshire and underwent a minimally invasive procedure of coronary stenting.
He has spent most of lockdown residing at Windsor Castle with the Queen for their safety, alongside a reduced household of staff dubbed HMS Bubble.
The 94-year-old monarch has continued to carry out her official duties by video.
The couple, who have been married for 73 years, received their first COVID-19 jabs in January.