Story highlights Prince Philip, 96, was being treated for an infection

He had announced his retirement from public life last month

London (CNN) Prince Philip, the 96-year-old husband of Britain's Queen Elizabeth II, was discharged from hospital on Thursday after spending two nights there as a "precautionary measure," Buckingham Palace told CNN.

"I can confirm that the Duke of Edinburgh left hospital this morning," a Palace spokesman told CNN's Max Foster.

The Prince was admitted on Tuesday evening to London's King Edward VII Hospital, where he was treated for an infection arising from a pre-existing condition.

The Queen and Prince Philip arrive at Royal Ascot on Tuesday.

"Prince Philip is in good spirits and is disappointed to be missing the State Opening of Parliament and Royal Ascot," Buckingham Palace said in a statement on Wednesday. The Prince, who has been by the Queen's side for their nearly 70 years of marriage, was absent as the monarch gave her annual speech at the opening of Parliament.

Just one day before being admitted to hospital, the Prince had donned a top hat for the Royal Ascot horse races in Berkshire, England.

Read More