Mr. Trump would hardly be the first contentious leader to be honored with a state visit. The queen, acting as always on the recommendation of the government, has in the past received President Robert Mugabe of Zimbabwe, the Romanian dictator Nicolae Ceausescu and President Mobutu Sese Seko, the former leader of Zaire, now the Democratic Republic of Congo. After a recent visit with President Xi Jinping of China, she was caught on camera speaking of how “very rude” the Chinese leader had been.

“A queen who has been asked over the decades to host tyrants such as Presidents Mobutu of Zaire and Ceausescu of Romania is going to take a brash billionaire from New York effortlessly in her stride,” William Hague, a former foreign secretary, wrote in The Daily Telegraph.

Still, the prospect of Mr. Trump’s visit has stirred great passion in Britain. The online petition, backed by 1.8 million people, does not call for Mr. Trump to be barred from Britain altogether, only that his visit be a political one, without the involvement of Queen Elizabeth II.

Another online petition, signed by more than 300,000 people, called for the state visit to take place. Petitions with more than 100,000 signatures are eligible for parliamentary debate, and any vote would not be binding. The government of Prime Minister Theresa May has been firm in saying that the invitation to Mr. Trump for a full state visit this year will not be withdrawn.

In Parliament, Mr. Flynn cited the need to keep public trust in politicians and noted that no president had ever been invited for a state visit in his first year in office. He also accused Mr. Trump of acting “like a petulant child” and said the queen should not be seen as approving either his actions or his attitudes toward women and Muslims.