London (CNN) -- Queen Elizabeth II's husband Prince Philip was released from a hospital in Scotland on Monday after being treated for a bladder infection.
Philip, the Duke of Edinburgh, was admitted to Aberdeen Royal Infirmary in Scotland on Wednesday.
The 91-year-old, who first suffered the problem in June, fell ill again as he was staying at the royal residence in Balmoral, Scotland, where the queen traditionally spends part of the summer.
Buckingham Palace said Wednesday he had been taken to the hospital as a precautionary measure and was likely to be kept in for several days.
It is the third time Philip has been hospitalized in the past eight months.
Before the bladder infection, which he initially contracted during events marking the queen's diamond jubilee, he spent four nights in a hospital over the Christmas holiday last year for treatment of a blocked coronary artery.
However, he appeared in good health last week as he fulfilled several engagements on the Isle of Wight, off the south coast of England.
Philip's next scheduled public appearance is alongside the queen as she opens the London 2012 Paralympic Games on August 29.
He appeared by her side at the opening ceremony for the Olympic Games at the end of July and accompanied her on a visit to the Olympic Park as the events got under way.
It has been a particularly busy year for the queen and Duke of Edinburgh because of the many events held to celebrate her diamond jubilee.
Addressing Parliament in March, the queen paid tribute to her husband as "a constant strength and guide" throughout her long reign.
The longest-serving consort in British history, Philip married then-Princess Elizabeth in November 1947 at Westminster Abbey.
Born the prince of Greece and Denmark on the Greek island of Corfu in 1921, Philip left Greece with his family when he was 18 months old after King Constantine was forced to abdicate the throne following a revolution. The family moved to Paris and then to England in 1928. Philip also went to school in Germany.
Philip renounced his Greek title when he became a naturalized British subject in 1947.
CNN Royal Correspondent Max Foster contributed to this report.