London Mayor Boris Johnson has caused controversy in the United Kingdom by claiming that US President Barack Obama has an "ancestral dislike" for Britain as a result of his "part-Kenyan" heritage.

His comments came after Obama, on a London visit, angered proponents of a so-called Brexit by saying the UK is better off by staying in the European Union.

In an opinion essay published in the right-leaning tabloid The Sun, the mayor criticised Obama's eagerness to urge British voters to remain in the EU and argued that the president may be "anti- British".

Johnson, who is seen as the unofficial leader of the campaign for the UK to leave the EU, claimed in his article that Obama removed a bust of Britain's war-time prime minister Sir Winston Churchill from the Oval Office shortly after he became president in 2009.

I love Winston Churchill. Love the guy. Barack Obama

"Some said it was a snub to Britain. Some said it was a symbol of the part-Kenyan president’s ancestral dislike of the British empire - of which Churchill had been such a fervent defender" wrote the London mayor.

However, his remarks about Obama’s heritage did not score Johnson any points in the EU discussions. Instead, he was branded "racist" by several prominent MPs.

Tory MP Sir Nicholas Soames, who is the grandson of Sir Winston Churchill, said Johnson’s comments were "appalling" and "totally wrong on almost everything".

"Time and time again, his judgment is awry and he shows in this article a remarkable disregard for the facts, the truth and for all judgment," he told LBC radio. "I don’t think Boris has the stature to be leader."

Sir Nicholas also said it was inconceivable that Churchill would not have welcomed the views of Obama.

OPINION: Brexit and the failure of the EU project

John McDonnell, Labour Party's shadow chancellor, suggested that Johnson's remarks were "racist".

"Mask slips again," he tweeted. "Boris part-Kenyan Obama comment is yet another example of dog-whistle racism from senior Tories. He should withdraw it."

Support for the mayor, however, came from UKIP party leader Nigel Farage, who also campaigns for UK to leave the EU. The far-right party leader said Obama should "butt out".

Accusing him of being the most anti-British American president in history, the far-right party leader told the Radio 4’s World at One programme: "I think Obama, because of his grandfather and Kenya and colonisation, I think Obama bears a bit of a grudge against this country."

'I love Churchill'

Obama responded to Johnson's comments on his alleged "ancestral dislike" for Britain in a press conference on Friday.

Talking next to British Prime Minister David Cameron, Obama said he loved Churchill and still had a bust of the British leader in his White House private residence.

"Right outside the door of the Treaty Room, so that I see it every day - including on weekends when I’m going into that office to watch a basketball game - the primary image I see is a bust of Winston Churchill," he said.

"It’s there voluntarily because I can do anything on the second floor. I love Winston Churchill. Love the guy."

Obama said there was a bust of Churchill in the Oval Office during the presidency of his predecessor George W Bush but he decided that he would have a bust of the civil rights leader Martin Luther King in his office instead.

"I thought it was appropriate - and I think most people in the United Kingdom might agree - that as the first African-American president, it might be appropriate to have a bust of Dr Martin Luther King in my office," he said.