LONDON — The Republican presidential contender Donald J. Trump has lashed out at a petition seeking to bar him from entering Britain, saying that politicians there should thank him rather than “pandering to political correctness.”

Mr. Trump’s comments on Monday that foreign Muslims should be barred from entering the United States gave added traction to the online petition, which called for him to be refused entry into Britain on the basis of laws against hate speech.

The petition had garnered nearly 500,000 signatures as of early Friday , easily passing the threshold of 100,000 supporters that requires Parliament to consider debating the issue.

Mr. Trump has also gained some support in Britain, however, and a counterpetition titled “Don’t Ban Trump From the United Kingdom” had more than 26,000 signatures by early Friday. Calling the proposal to bar Mr. Trump “illogical,” the counterpetition urged Britons to “mind our own business.”