The Duke of Edinburgh was discharged from hospital “in good spirits” on Tuesday, four weeks after being admitted.

Prince Philip, 99, was carefully shielded as he left the King Edward VII hospital in central London for the 27-mile trip back to Windsor Castle, where he was reunited with the Queen.

Hospital staff set up a large white screen and dozens of police officers blocked off the road as he was pushed out in a wheelchair at 10.30am, following 28 nights as an in-patient, his longest ever hospital stay.

On arrival back in Windsor around an hour later, the Duke, wearing a white shirt and yellow jumper, managed a wave to well wishers as his vehicle swept inside the castle gates.

Buckingham Palace said in a statement: “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.”

The Duke, who turns 100 in June, was admitted to hospital on February 16 for “a few days of observation and rest” after feeling unwell but contracted an infection and was later transferred to a leading cardiac unit for surgery relating to a pre-existing heart condition.

Palace aides initially insisted that his admission was merely a “a precautionary measure”, and that doctors were acting “with an abundance of caution.”

However, three days later, it emerged that his stay was being extended and that he would remain in hospital for “observation and rest”.

Meanwhile, the Queen continued with official duties as normal and sources close to senior members of the family suggested  there was no cause for alarm.

The Prince of Wales visited his father on February 20, apparently to update him on matters concerning the Duke and Duchess of Sussex.

Prince Charles made a 200 mile round trip from Highgrove to spend half an hour at the Duke’s bedside and appeared emotional as he left.