Despite being 95, Philip's decision - supported by the Queen and not medically related - came as a surprise and followed a night of frenzied speculation caused by news reports about an "emergency" palace meeting.
"His Royal Highness the Duke of Edinburgh has decided that he will no longer carry out public engagements from the autumn of this year", the palace statement said.
"Her Majesty will continue to carry out a full programme of official engagements with the support of members of the Royal Family", the statement said in regards to the Queen.
Tall, craggy-faced and always elegantly dressed, Philip is as famous for his occasional off-color gaffes and one-liners as he is for his devotion to the monarch, and he joked about his retirement at an Order of Merit reception at St. James's Palace.
Prime Minister Theresa May offered him the whole country s "deepest gratitude and good wishes".
Responding to a comment from mathematician Michael Atiyah, who told him he was sorry to hear he was standing down, Philip quipped: "Well I can't stand up much longer".
He will attend previously scheduled engagements until August, and would not accept any new invitations thereafter.
Prince Philip playing polo in 1952.
Mulayam camp ups ante: Aparna Yadav demands Akhileshs resignation as SP chief
Party sources said a Samajwadi Party split is imminent and there is a waiting game on as to who blinks first. Shivpal is also likely to meet senior leaders to tap in to discontent.
"Although meetings involving the entire royal household are occasionally called, the way this has been done at the eleventh hour is highly unusual and suggests that there is something major to be disseminated", a source told the Daily Mail. "Although he may still choose to attend certain public events from time to time".
Prime Minister Theresa May led the tributes to the Queen's consort, saying he has given the monarch "steadfast support", while Labour leader Jeremy Corbyn said the Duke's "clear sense of public duty" had inspired people for more than 60 years.
The couple, who are due to celebrate their platinum, or 70th, wedding anniversary in November, have been cutting their workload in recent years, passing on many responsibilities to son and heir Prince Charles, and grandsons, Princes William and Harry.
May said Prince Philip s contribution to Britain, the Commonwealth and the wider world would be "of huge benefit to us all for years to come".
They were all carried out in Britain as Queen Elizabeth and her husband have cut down their overseas travel.
He represented the royal family in more than 200 events in 2016.
The news was announced by Buckingham Palace after a much-publicised meeting of Royal Household staff.