British MPs have spent three hours in the House of Commons debating whether to ban US presidential hopeful Donald Trump from the UK.

The debate was sparked by a petition, signed by more than 570,000 people, calling for Mr Trump to be banned from entering the UK after his comments about Muslims and Mexicans.

MPs from all sides criticised Mr Trump during the heated discussion, branding him an "attention seeker", a "fool", a "buffoon", a "demagogue" and a "wazzock" — British slang for a stupid or annoying person.

But many more MPs opposed the ban, saying it would go against free speech.

Ultimately the MPs did not vote on the matter, and Prime Minister David Cameron, who has the final say, had already indicated he had no intention of banning Mr Trump.

British MP Tulip Siddiq from the opposition Labour Party was in favour of the ban, telling Parliament Mr Trump risked inflaming tensions between vulnerable communities.

A petition is calling for Donald Trump to be banned from entering the UK. ( UK Parliament website )

"People often say that the public are apathetic about politics," she said.

"This online petition, signed by nearly 600,000 people, shows that when people feel a sense of justice, when people feel that we need to stop a poisonous, corrosive man from entering our country, they will act in good conscience."

The British home secretary can and does ban people from entering the UK, but the Conservative MP Paul Scully questioned whether it was necessary in this case.

"I know we've had some examples of where people have been excluded from this country, I've heard of a number of cases where people have been excluded for incitement, for hatred — I've never heard of one for stupidity," he said.

"And I'm not sure that we should be starting now."

Labour MP Paul Flynn said Donald Trump's prejudices should be met with British reasonableness.

"Could I put it to the committee that the great danger by attacking this one man is that we can fix on him a halo of victimhood, we give him the role of martyrdom which conceived to be an advantage among those that support him."

Mr Trump called for a "total and complete shutdown" of US borders to Muslims in the days after the San Bernardino shooting.

And he has recently defended his plan to build a wall to stop illegal immigration between the US and Mexico.

He responded to the petition last month by saying Britain was trying to disguise a massive Muslim problem.

He also threatened to cancel more than £700 million of planned investments in his golf courses in Scotland.

Under British law, any petition supported by 100,000 people is considered for parliamentary debate.