LONDON (Reuters) - Prince Philip, the 96-year-old husband of Britain’s Queen Elizabeth, bowed out of public life on Wednesday with his final solo appearance at an official event, ending a royal career marked by occasional gaffes that landed him in hot water.

Britain's Prince Philip, in his role as Captain General, Royal Marines, attends a Parade to mark the finale of the 1664 Global Challenge, on the Buckingham Palace Forecourt, in central London, Britain August 2, 2017. REUTERS/Hannah McKay

The prince, also known as the Duke of Edinburgh, attended a parade of Royal Marines at Buckingham Palace and met servicemen that had taken part in a 1,664 mile race to raise money for the Royal Marine’s Charity.

Though known for often off-color comments that seized the headlines, Philip has been by the queen’s side throughout her 65 years on the throne and she has described him as “my strength and stay”.

He announced his retirement in May this year, after completing more than 22,000 solo appearances, spanning seven decades. At an engagement on the day of the announcement, a guest had told Philip he was sorry to hear he was standing down.

“I can’t stand up much,” quipped the prince.

Both the queen and Prince Philip have cut their workload in recent years, passing on many responsibilities to son and heir Prince Charles, and grandsons, Princes William and Harry.

Philip spent two days in hospital in June for treatment for an infection. 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.

Philip married Elizabeth at Westminster Abbey in 1947, and the couple are due to celebrate their 70th wedding anniversary in November.

Outspoken, irascible and intensely private, Philip developed a reputation for occasional brusque and sometimes politically incorrect comments at ceremonial events he attended.

A stray remark about “slitty eyes” during a visit to China in the 1980s became symbolic of his gruff and often unguarded manner.

During a visit to Oban in Scotland in 1995 he asked a driving instructor: “How do you keep the natives off the booze long enough to pass the (driving) test ?”

Well into his 90s, he made headlines when he exasperatedly swore at a photographer at a 2015 event.

Nonetheless, the queen has described him as a crucial figure during her long reign.

Slideshow ( 5 images )

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

In his last public engagement on Wednesday, Philip, sporting a bowler hat and mac, met serving troops, veterans and cadets in the pouring rain, before watching as a unit of marines marched past him in formation in a ceremonial procedure known as taking the salute.

Afterwards, the soldiers let out three cheers for the prince, with one more coming from a watching crowd behind. As well as raising his hat for the troops, Philip also waved to the crowd as he left.

Philip has been captain general of the marines since 1953, and has a personal connection with the Royal Navy after serving with the force in the Second World War.