The Duke of Edinburgh met Royal Marines in his final solo public engagement before he retires from royal duties.
The 96-year-old announced his retirement in May, after decades of supporting the Queen as well as attending events for his own charities and organisations.
Prince Philip has completed 22,219 solo engagements since 1952.
Prime Minister Theresa May took to Twitter to thank him for "a remarkable lifetime of service".
She added that she hoped he "can now enjoy a well-earned retirement".
As Captain General of the Royal Marines, the duke attended a parade to mark the finale of the 1664 Global Challenge - a series of strength and endurance challenges raising funds and awareness for charity.
While his diary of engagements will come to an end, Buckingham Palace has said the duke may still decide to attend certain events alongside the Queen in the future.
The Queen's public schedule will continue as normal.
Cpl Jamie Thompson, 31, who attended the event - which was held in the rain outside Buckingham Palace - said it was "historic".
"This is the duke's last royal engagement and we're a part of it, the Royal Marines are a part of it - so it's an absolute honour," he said.
Cpl Thompson ran 1,664 miles over 100 days with Corporal Will Gingell, 33, as part of the challenge.
The duke also met Sgt Matt Burley, a physical training instructor, who swam 1,664 lengths underwater over 10 days, and Lt Col Aldeiy Alderson, who ran 100km (62 miles) in 12 hours wearing his Royal Marines uniform
After hearing about their exploits, he told the group of marines: "You all should be locked up."
The duke was also handed the 1664 Global Challenge baton, before raising his hat and waving it to acknowledge three cheers in his honour.
Earlier, Lady Myra Butter, who has known Prince Philip since the age of eight or nine, told Radio 4's Today programme he was "very spirited, a young normal boy full of fun... we loved when he came to stay".
Asked about what the duke would do next, she said: "I'm sure that he won't disappear, he will be greatly missed by everybody.
"He's been such a stable character in all our lives - he's always there and he's always been there for the Queen and I think we're very, very lucky to have him."
On announcing his retirement earlier this year, the royal consort was praised for his years of service, with Prime Minister Theresa May offering the country's "deepest gratitude and good wishes".
Labour leader Jeremy Corbyn wished him "all the best in his well-earned retirement".