LONDON (Reuters) - Prince Philip, the 95-year-old husband of Britain’s Queen Elizabeth, joked on Thursday about no longer being able to “stand up much” as Buckingham Palace announced he would retire later this year from active public life.

Philip, who is also known as the Duke of Edinburgh and has sometimes drawn attention with headline-grabbing gaffes, has been by the queen’s side throughout her 65 years on the throne and she has described him as “my strength and stay”.

“Prince Philip will attend previously scheduled engagements between now and August, both individually and accompanying The Queen,” the palace said in a statement.

“Thereafter, The Duke will not be accepting new invitations for visits and engagements, although he may still choose to attend certain public events from time to time.”

The queen, the world’s longest-reigning living monarch who celebrated her 91st birthday in April, will continue to carry out a full program of official engagements, the statement added. Polls show Elizabeth, who ascended to the throne in 1952, remains hugely popular among Britons.

At an engagement at St James’s Palace in central London with his wife on Thursday, a guest told Philip he was sorry to hear he was standing down.

“I can’t stand up much,” quipped the prince, whose off-the-cuff remarks have sometimes landed him in hot water.

The announcement of Philip’s retirement was made following a meeting of all senior royal staff at Buckingham Palace, news of which prompted media speculation about the health of the royals.

However a well-placed source said there was no cause for concern about the health of the queen or Philip, who turns 96 next month. The couple, who married at Westminster Abbey in 1947, are due to celebrate their platinum, or 70th, wedding anniversary in November.

They have both been cutting their workload in recent years, passing on many responsibilities to son and heir Prince Charles, and grandsons, Princes William and Harry.

Philip conducted 184 official appearances in the year to March 2016 and has racked up a total 22,191 solo engagements since 1952, official figures show.

Prime Minister Theresa May offered the country’s “deepest gratitude and good wishes” to Philip on his retirement.

Slideshow ( 33 images )

GAFFES

Outspoken, irascible and intensely private, Philip, a Greek-born former naval officer, developed a reputation for brusque comments and occasional gaffes at some of the thousands of ceremonial events he has attended.

A stray remark about “slitty eyes” during a visit to China in the 1980s became symbolic of his gruff and often unguarded manner. Even into his 90s, his off-the-cuff remarks could still get him into trouble, such as when he exasperatedly swore at a photographer at an event in 2015.

However, the queen and other royals say he has been a crucial figure during her long reign.

Slideshow ( 33 images )

“He has, quite simply, been my strength and stay all these years,” Elizabeth said in a very rare personal tribute to Philip during a speech to mark their 50th wedding anniversary in 1997.

Despite being at the forefront of the royal family for almost 70 years and also patron, president or a member of more than 780 organizations, he has no clear-cut constitutional role and has admitted struggling to carve out a role for himself as the queen’s consort.

“There was no precedent. If I asked somebody ‘what do you expect me to do?’ they all looked blank - they had no idea, nobody had much idea,” he told the BBC in an interview to mark his 90th birthday.

Both the queen and Philip have suffered some health issues in recent years. The queen missed a traditional Christmas church service last year for the first time in decades due to a heavy cold and was hospitalized in March 2013 with symptoms of gastroenteritis.

Philip underwent “an exploratory operation following abdominal investigations” in 2013.

He was also hospitalized for a bladder infection during the queen’s Diamond Jubilee celebrations the year before, and spent Christmas 2011 in hospital where he underwent an operation to clear a blocked heart artery after suffering chest pains.

Such setbacks did not deter Philip from his royal duties. He even drove former U.S. President Barack Obama and his wife around the grounds of the royals’ Windsor Castle residence during a visit last year.

“I have to say I have never been driven by a Duke of Edinburgh before, but I can report it was very smooth riding,” Obama said.