A Trump surrogate has falsely accused Barack Obama of golfing after Wall Street Journal reporter Daniel Pearl was murdered by terrorists.

Kayleigh McEnany, also a CNN commentator, made the error while attempting to defend President Donald Trump’s golfing habits.

Mr Trump frequently rebuked his predecessor Barack Obama for playing golf but has regularly played the sport since taking office. Over the weekend Mr Trump took his twelfth golfing holiday since his presidential inauguration almost ten weeks ago.

Ms McEnany accused President Obama of playing golf at inappropriate times during his presidency on Monday night.

“You had President Obama, who after the - I believe it was the beheading of Daniel Pearl - spoke to how upset he was about that, then rushed off to a golf game,” she said on CNN.

“I think when we're in a state of war, when we're in a state of mourning, you should take time off from the golf course.”

Pearl was kidnapped by terrorists in Pakistan and murdered in the country back in 2002 when George W Bush was president and Obama was just a senator in Illinois.

Ms McEnany apologised for the blunder on Twitter on Tuesday morning and claimed she had used the wrong name. The surrogate suggested she had meant to refer to James Foley, a freelance photojournalist who was kidnapped in Syria and beheaded by Isis in 2014.

"I apologise for using the wrong name. Both James Foley and Daniel Pearl lost their lives to terrorism & should be honoured by our leaders," she said.

Sevnica: Melania Trump's home town Show all 18 1 /18 Sevnica: Melania Trump's home town Sevnica: Melania Trump's home town The 12th-century castle dominates Sevnica old town Getty Images Sevnica: Melania Trump's home town The old town has a beautiful riverside setting Getty Images Sevnica: Melania Trump's home town 'White House' slippers in Sevnica castle Nick Redmayne Sevnica: Melania Trump's home town The annual salami festival, the Salamiada Nick Redmayne Sevnica: Melania Trump's home town Sevnica was a nondescript town before Melania hit the big time AFP/Getty Images Sevnica: Melania Trump's home town Sevnica butchers take their sausage-making skills seriously Nick Redmayne Sevnica: Melania Trump's home town Only men are allowed in the Salamiada Nick Redmayne Sevnica: Melania Trump's home town As American as.... a Sevnica apple pie Nick Redmayne Sevnica: Melania Trump's home town There are no plans to make a Donald pie Nick Redmayne Sevnica: Melania Trump's home town The slippers featured in a recent fashion show AFP/Getty Images Sevnica: Melania Trump's home town The castle is one of the top tourist sites in town Getty Images Sevnica: Melania Trump's home town Melanija cake has gone down a storm AFP/Getty Images Sevnica: Melania Trump's home town The smart house still owned by Melania's parents Nick Redmayne Sevnica: Melania Trump's home town They live in America but visit occasionally Nick Redmayne Sevnica: Melania Trump's home town The communist block of flats in which Melania grew up Nick Redmayne Sevnica: Melania Trump's home town Melania skin cream, for a presidential complexion Nick Redmayne Sevnica: Melania Trump's home town First lady chocolates, dusted with gold Nick Redmayne Sevnica: Melania Trump's home town Even locals can't get enough of the Melanija cake Nick Redmayne

The Trump surrogate came under fire for the mistake on Twitter and people accused her of incompetence and trying to politicise their deaths.

"This is horrible - and disrespectful of Daniel Pearl's life and his family's pain - why is she still on the air? Facts matter," said Rebekah Jacob.

The hashtag #ObamaWasGolfingWhen gained increasing traction on the social media site, with people joking about times he had played the sport.

“Obama also went golfing right after Lincoln was shot,” quipped one, while another joked he was golfing when "JFK was assassinated".

Mr Obama was on holiday on Martha's Vineyard, an island in Massachusetts, when news of Foley's death emerged. He delivered remarks condemning Foley's killing from the Massachusetts island but made a trip to a golf course soon afterwards and was hounded by critics. He was later forced to admit that he should not have made the trip.

“It is always a challenge when you're supposed to be on vacation,” he told Chuck Todd on NBC's Meet the Press a few weeks later. “There's no doubt that, after having talked to the families, where it was hard for me to hold back tears listening to the pain that they were going through, after the statement that I made, that you know, I should've anticipated the optics.”

On the campaign trail, Mr Trump said he would not have time to play golf once president because he would be too busy. Prior to taking office, Mr Trump regularly rebuked President Obama for playing golf and did so as recently as January 2015.

“Can you believe that, with all of the problems and difficulties facing the U.S., President Obama spent the day playing golf. Worse than Carter,” he wrote in October 2014.