Some might call it a gaffe, others described it as a display of his trademark dry humour, but 2017 was unlikely to reach its end without Prince Philip making headlines for one of his off-the-cuff remarks.

The Duke of Edinburgh was said to be joking with guests on his way to a New Year's Eve service at St Mary Magdalene church in Sandringham when he saw a man with long, ginger facial hair.

With his daughter Princess Anne in tow, the prince reportedly asked a bodyguard "Is that a terrorist?"

An onlooker in the crowd told the Sun that the man with the beard appeared to be with his wife and child.

Ian Smith, 39, told the paper: "He was obviously having a little joke, but he said it within earshot of the man who burst out laughing and appeared to find the whole thing hilarious. I think Philip knew he was going to be overheard.

"I'm sure Philip didn't mean any harm. His grandson Prince Harry has a ginger beard, so perhaps Philip had been cracking jokes about that over Christmas. Everyone knows Prince Philip has got a sense of humour, although some people might have thought it was a risqué comment."

He cracked jokes with others present including with Alison Leggett, 54, of Hunstanton, Norfolk. After he saw her old fox red labrador lying on the wet ground, he said: "I hope he hasn't got rising damp". Buckingham Palace declined to comment.

Prince Philip
Prince Philip is pictured at the Remembrance Sunday Cenotaph service in London, on 12 November 2017. Reuters

Prince Philip stepped down from Royal duties earlier this year after more than 22,000 engagements. During that time, the prince, 96, has made a number of comments that have caused controversy.

In 1995, he told a Scottish driving instructor: "How do you keep the natives off the booze long enough to pass the test?" In 2013, he told a nurse at Luton and Dunstable University: "The Philippines must be half empty, you're all here running the NHS!"

In 1999, he told children from the British Deaf Association, standing by a steel drum band: "If you're near that music, it's no wonder you're deaf". One of his most infamous comments came in 1986, when he told British exchange students in Beijing: "If you stay here much longer you'll all be slitty eyed".