The Duke of Edinburgh has been admitted to hospital as a "precautionary measure" for treatment of an infection arising from a pre-existing condition, Buckingham Palace said.
Philip, who turned 96 last week, was supposed to be accompanying the Queen to the State Opening of Parliament on Wednesday but his place has been taken by the Prince of Wales.
A Buckingham Palace spokesman said: "The Duke of Edinburgh was admitted to King Edward VII Hospital in London last night, as a precautionary measure, for treatment of an infection
arising from a pre-existing condition.
"Prince Philip is in good spirits and is disappointed to be missing the State Opening of Parliament and Royal Ascot.
"The Prince of Wales will accompany the Queen to the State Opening.
"Her Majesty is being kept informed and will attend Royal Ascot as planned this afternoon."
The Duke was at the Queen's side on Tuesday for the opening day of Royal Ascot and seemed in good spirits.
He has enjoyed good health throughout much of his life, recovering from a blocked coronary artery in 2011 and a bladder infection in 2012, the latter leading him to miss the majority of
the Queen's Diamond Jubilee celebrations.
His decision to retire from public duties after the summer was not health-related, Buckingham Palace said at the time of the announcement earlier this year.
The Duke is an advocate of healthy eating combined with exercise. He once said he more or less followed the Atkins diet and he drinks only moderately.
He takes the stairs rather than lifts and still fits into the uniform he wore on his wedding day.
He is well-known for his robust constitution. He told a flu expert at a research centre last year that he had not had the illness for 40 years.
It is understood the Duke was not admitted as an emergency but, on the advice of a doctor, was driven from Windsor Castle to hospital in London on Tuesday evening.