Britain's Prince Philip was taken to the hospital Tuesday night for treatment of an infection, Buckingham Palace said.

The Duke of Edinburgh was admitted to a hospital in London as a "precautionary measure." The infection was caused by a pre-existing condition, Buckingham Palace said in a statement. He suffered heart ailments in the past.

The statement added that Philip was "in good spirits."

Philip, who is Queen Elizabeth II's husband, missed the State Opening of Parliament on Wednesday.

Philip, 96, announced he will be stepping down from attending public events last month.

The queen outlined the country's legislative agenda that was dominated by preparation for Britain's departure from the European Union. In her brief speech, she announced a new commission for countering extremism.

The Associated Press contributed to this report.