For many Britons, the defining characteristic of Prince Philip was not his public service or his royal standing, but his propensity to make unscripted, off-the-cuff and sometimes wildly inappropriate comments.

The longest-serving consort in the history of the British monarchy died aged 99 on Friday, leaving behind a lengthy catalog of provocative remarks that cemented his reputation as an outspoken royal, untamed by the family's carefully rehearsed public image.

Viewed charitably, those utterances could be seen as examples of a mischievous British sense of humour.

In 2011, then-Prime Minister David Cameron paid tribute to Philip's wit, saying: "Humour is a great part of British life and we thank the duke for his unique contribution."

But some comments from the prince strayed undeniably into the realm of casual racism.

These remarks threatened to turn him into a caricature, and comments about China were so ill-judged that they were a scandal even in 1986.

But as the years have passed, his reputation has softened and some of his more problematic comments have faded in the collective British memory.

"He was a throwback to old-school racism. Painting him as a benign, cuddly uncle of the nation is simply untrue," said Kehinde Andrews, Professor of Black Studies at Birmingham City University, on Friday.

A LONG HISTORY OF CONTROVERSIAL REMARKS

Even as a lifelong royal who married into the British monarchy more than seven decades ago, Philip retained a reputation as something of an outsider.

He often flashed a self-deprecating humor that went down well at official occasions. "My generation, although reasonably well-schooled, is probably the worst educated of this age," he said at one such event.

"Don't ask me to explain why it is that (the Queen) has an official birthday in June, when her proper birthday's in April -- you'll just have to accept it," he said at another.

That reputation as a maverick was sometimes further boosted by his off-hand comments, which frequently dominated headlines on official trips and were occasionally picked up when the duke believed he was out of earshot.

In 1995, Philip riffed on a British stereotype that Scots enjoy a drink, asking a driving instructor in Scotland: "How do you keep the natives off the booze long enough to pass the test?"

He also became an unlikely public voice during the debate over gun control in Britain in the mid-1990s, which broke out after a shooting at Dunblane Primary School in Scotland left 16 dead.

"If a cricketer, for instance, suddenly decided to go into a school and batter a lot of people to death with a cricket bat, which he could do very easily... I mean are you going to ban cricket bats?" he said on BBC radio. It was an extraordinary intervention, as senior royals are expected to remain resolutely apolitical.

Sometimes, a comment from the prince presented royal officials with public relations fires that required rapid extinguishing. He came across as out-of-touch and aloof -- a charge the royals have often faced -- when he told NBC's "Meet the Press" in 1969 that the monarchy was running out of money, and that its members might have to move to smaller premises.

But it was his comments about other nationalities -- often inappropriate, occasionally racist and sometimes made on visits hosted by the nations who were the subject of them -- that most complicate his legacy.

Since Philip's death was announced, some on social media have argued that his more problematic remarks should not be dismissed.

"Many of the same people who were having conversations about Prince Philip's history of racism and colonialism are now saying we should also mourn him," Frederick Joseph, an American writer whose book about his experiences with racism was published last year, tweeted on Friday.

And the timing of the duke's death, just weeks after the royal family became embroiled in a row over racism following an interview given by the Duke and Duchess of Sussex to Oprah Winfrey, has added to the intensity of debate.

Egyptian-American commentator Mona Eltahawy called the blanket news coverage of Philip's death "ridiculous," saying he belonged to an institution "which colonized and pillaged so extensively."

Other online users, meanwhile, resurfaced a 2017 Al Jazeera opinion piece by Hamid Dabashi, Professor of Iranian studies and comparative literature at Columbia University, which concluded: "There is a beautiful barbarity of truth to Prince Philip's racism, exposing the ugly hypocrisy at the very foundation of 'Western civilization.'"

The prince himself once noted his expertise in "dontopedalogy -- the science of opening your mouth and putting your foot in it" -- something, he said, he had "practiced for a good many years."