Labour MPs have accused David Cameron of racism, gutter politics and "dog whistling" about a Muslim politician.

A furious row erupted after the Prime Minister attacked Labour’s candidate for London mayor and accused him of sharing platforms with known extremists.

Labour said the comments, in the middle of a hotly contested election, were “beneath” the Prime Minister.

The race to replace Boris Johnson as mayor has been dogged by allegations of thinly veiled racism for weeks.

The Conservatives have been accused of highlighting the fact that their opponent is a Muslim for political gain.

Mr Cameron told MPs that he questioned Sadiq Khan’s “judgement” for appearing alongside Suliman Gani, a man who Mr Cameron claimed "supports Islamic State".

His attack echoed similar allegations from Tory London candidate Zac Goldsmith.

Mr Cameron said: "If we are going to condemn not just violent extremism but also the extremism that seeks to justify violence in any way it is very important that we do not back these people and we do not appear on platforms with them, and I have to say I am concerned about Labour's candidate as mayor of London, who has appeared again and again and again.”

There was a furious response from Labour MPs, some of whom immediately shouted “racist” at Mr Cameron.

The Labour leader Jeremy Corbyn could be also heard shouting from his seat: “"That's disgraceful and you know it."

But Mr Cameron refused to back down, saying that Mr Khan had shared a platform with Mr Gani nine times.

Mr Khan has previously defended himself saying that his work as a human rights lawyer and with the organisation Liberty had brought him into contact with extremists.

"I have been quite clear that I find their views abhorrent.," he has said.

Former Labour leadership candidate Chuka Umunna said the comments were “utterly disgraceful”.

Labour MP Alison McGovern accused the Prime Minister of an "act of desperation”.

Mr Corbyn's spokesman said: "It demeans the office of the Prime Minister to repeat these smears. Sadiq has been very strong on issues around terrorism."

Before his controversial comments Mr Cameron told MPs extremism was the preserve of a “very small minority”.

“What we are seeing is a small minority...believing there is only one way, a violent extremist way of expressing their faith," He said.

Former Labour frontbencher Rachel Reeves, who described the attacks as "gutter politics", said: "I served in the shadow cabinet with Sadiq Khan for many years, he’s a man of the utmost integrity, he has taken on extremism in the Islamic community and on many occasions he has fallen out with leaders in the Islamic community, for example on equal marriage. So the idea that he is somehow a friend of extremists, a friend of terrorists, I think is beyond contempt.”

For his part Mr Khan accused the Conservatives of running a "nasty, dog-whistling campaign that is designed to divide London's communities".

He said that he was "disappointed" at Mr Cameron's comments, adding: "As mayor, I will be the British Muslim who takes the fight to the extremists,."

A No 10 source said that Tooting imam Mr Ghani had made a speech on the night of the Paris terror attacks calling for the establishment of an Islamic state.

He dismissed accusations of racism as "complete nonsense"

Mr Ghani's Facebook page shows a photograph of him with Mr Goldsmith.

He has also spoken at meetings reportedly attended by Conservative MP Jane Ellison.

"