LONDON -- For over 65 years, he has been the unwavering presence alongside Britain's longest-serving monarch, the consummate consort and royal representative.

On Wednesday Prince Philip, 96, made his 22,219th -- and final -- solo public engagement, braving heavy rain to meet Royal Marines at Buckingham Palace.

The royal appeared in good spirits, waving to cheering crowds and joking with the soldiers, who have completed a 2,678-kilometre trek to raise money for charity.

"You all should be locked up," he quipped, making the soldiers laugh.

Philip announced he was stepping down from public duties in May. The royal, known for his sense of humour and gaffes, recently joked about his big retirement day, telling celebrity chef Prue Leith: "I'm discovering what it's like to be on your last legs."

Also known as the Duke of Edinburgh, he will still appear at Queen Elizabeth II's side -- from time to time -- as the 91-year-old monarch soldiers on.

Philip is patron, president or a member of over 780 organizations, with which he will continue to be associated -- but he won't play an active role by attending engagements. The queen supported the decision.

Wednesday's event marks a major landmark for the man born Prince Philip of Greece and Denmark in Corfu on June 10, 1921, to Princess Alice of Battenberg and Prince Andrew of Greece. Amid the upheaval of the military coup that overthrew his uncle, King Constantine, in 1922, the family fled.

King George V, the queen's grandfather, sent a Royal Navy cruiser to evacuate Philip's family and he was whisked to safety in a cot made from an orange box. Later, he rarely saw his parents and went to school in Germany and Britain.

Philip has had a long association with the military and had once had promising military career. He joined the Royal Navy as a cadet in 1939 and served during the Second World War, winning mention in dispatches for service aboard the battleship HMS Valiant at Cape Matapan, on Greece's Peloponnesian peninsula. He rose to the level of commander.

Two years after the war ended, Philip married the future queen at Westminster Abbey when she was 21 and he was 26. He renounced his Greek title and King George VI made him the Duke of Edinburgh. His career came to an abrupt end with George's death in 1952. At the queen's coronation in 1953, Philip swore to be his wife's "liege man of life and limb." He settled into a life supporting Elizabeth in her role as queen and they had four children -- Charles, Anne, Andrew and Edward.

Philip has given 5,496 speeches, written 14 books and gone on 637 solo visits overseas.

He's championed environmental and conservation issues, and has interests in science, engineering and industry. An accomplished sportsman, he played polo regularly until 1971. He earned his RAF wings in 1953, his helicopter wings in 1956 and his private pilot's license in 1959.

All that activity has led to overall good health. But Philip has been admitted to the hospital on a number of occasions in the last few years for abdominal surgery, bladder infections and a blocked coronary artery.

Many of his health issues are related to sports. He has arthritis in his right wrist and broke a bone in his ankle from playing polo. He developed a rheumatic condition of the tendon in the hand after a taking a fall in polo.

He takes the stairs rather than elevators and can still fit into the uniform he wore for his wedding. He was only seen wearing hearing aids for the first time at a palace reception in 2014 at the age of 93.

The palace says his health wasn't behind the retirement decision.

Philip, who enjoys a slightly wicked turn of phrase, has poked fun at himself and his advancing years. In a letter to The Oldie magazine in 2011, he said he appreciated being named "Consort of the Year."

"There is nothing like it for morale to be reminded that the years are passing -- ever more quickly -- and that bits are beginning to drop off the ancient frame," he wrote. "But it is nice to be remembered at all."

Sylvia Hui contributed to this report