Sadiq Khan, who was elected mayor of London on Thursday, the first Muslim to hold the job, lashed out on Monday at Donald J. Trump, the presumptive Republican nominee for president, saying that Mr. Trump’s inflammatory remarks about Islam could threaten security in Britain and the United States.
“Trump’s ignorant view of Islam could make both our countries less safe,” Mr. Khan wrote on Twitter on Tuesday morning. “It risks alienating mainstream Muslims. London has proved him wrong.”
On Monday, Mr. Trump told The New York Times that “there will always be exceptions,” when asked how his proposal to bar Muslims from entering the United States would affect people like Mr. Khan.
“I was happy to see that,” Mr. Trump said of Mr. Khan’s election. “I think it’s a very good thing, and I hope he does a very good job because frankly that would be very, very good.”
Asked why, Mr. Trump said: “Because I think if he does a great job, it will really — you lead by example, always lead by example. If he does a good job, and frankly if he does a great job, that would be a terrific thing.”
Mr. Trump has been criticized for his proposed ban, which he announced soon after the terrorist attacks in and around Paris in November that killed 130 people.
In an interview with Time magazine published on Monday, Mr. Khan criticized Mr. Trump’s approach to Muslims and said he planned to visit the United States before the inauguration of the next president, on Jan. 20.
Mr. Khan, the son of working-class immigrants from Pakistan, was a human rights lawyer and was elected to Parliament, as a Labour member representing South London, in 2005.
In December, when Mr. Trump floated the idea of barring Muslims from the United States, Mr. Khan called Mr. Trump’s comments “divisive and outrageous” and said, “I hope Trump loses — badly.” Mr. Trump has urged a “total and complete shutdown of Muslims entering the United States” until political leaders can “figure out what is going on” with jihadist terrorism.
In his interview with Time, Mr. Khan said: “I want to go to America to meet with and engage with American mayors. If Donald Trump becomes the president, I’ll be stopped from going there by virtue of my faith, which means I can’t engage with American mayors and swap ideas.”
Mr. Khan told the magazine he was “confident” that Mr. Trump would not win the November election.
“Conservative tacticians thought those sort of tactics would win London, and they were wrong,” he said, referring to the divisive mayoral campaign in London, in which Mr. Khan’s opponent, Zac Goldsmith of the Conservative Party, criticized Mr. Khan’s past advocacy on behalf of criminal defendants, including his opposition to the extradition of a man who was later convicted in the United States of supporting terrorism.
Mr. Goldsmith accused Mr. Khan of giving “platforms and oxygen and cover and excuses” to extremists. Mr. Khan — who supports many things that are reviled by jihadists, like same-sex marriage — said any contact he had had with radicals had been only in the context of defending their human rights.
Mr. Khan told Time that his election had been a victory for a more diverse understanding of what it meant to be British, and he argued that it could contain an “antidote” to extremism.
“What I think the election showed was that actually there is no clash of civilization between Islam and the West,” he said, adding of jihadists, “What better antidote to the hatred they spew than someone like me being in this position?”
Mr. Khan said that his success and the success of other British Muslims — like the pop star Zayn Malik, the Olympic runner Mo Farah and the reality-television star Nadiya Hussain, who baked Queen Elizabeth II’s 90th birthday cake — showed young people that “you can be British, Muslim and successful.”