In the weeks between last year’s terrorist attacks in Paris and San Bernardino, Calif., Donald Trump and his closest aides began discussing an idea far outside the bounds of normal political debate: banning all foreign Muslims from entering the United States based solely on their religion.

To Trump and his advisers — including then-campaign manager Corey Lewandowski and then-political director Michael Glassner — the idea was a commonplace response aimed at the heart of the problem: radical Islam.

The campaign’s views were also heavily influenced by the Sept. 11, 2001, attacks, when al-Qaeda hijackers killed nearly 3,000 people, most of whom died in the collapsing World Trade Center, around 4½ miles from Trump Tower.

“My perspective on this is very much formed by 9/11,” said Glassner, who is now Trump’s deputy campaign manager. “I worked at the World Trade Center. Those people were radical Islamists, and they were trying to kill me and they killed 87 of my colleagues. . . . Why wouldn’t you start by trying to identify this demographic coming into the United States and see what they’re doing? It has nothing to do with religion; I think it had everything to do with the facts of who was perpetrating these crimes.”

Republican presidential candidate Donald Trump wants to stop almost all Muslims from coming into the United States. Here’s what he has said about Muslims since 2011. (Sarah Parnass/The Washington Post)

Trump has purposely and methodically made his proposed Muslim ban — and suspicion of American Muslims — a centerpiece of his nativist pitch to voters, along with promises to bring back jobs from overseas and crack down on illegal immigration. Trump has seized on the issue again this month in the wake of the massacre at a gay nightclub in Orlando, reiterating his support for blocking Muslims from the country after seeming to soften on the idea. He also alleged that many American Muslims and mosques are knowingly protecting terrorists, that the United States should consider profiling Muslims and that President Obama may be in league with Islamist extremists.

Trump’s rhetoric is a clear benefit for him among Republicans, a majority of whom support the idea of barring foreign Muslims from the country.

But the idea is largely opposed by Americans overall. It is also one of the key issues that divides Trump from Republican leaders, who fear he is poisoning the party’s chances with his incendiary comments about Muslims, Latinos and other minority groups.

Muslim advocates also are outraged by Trump’s repeated assertions, saying he is unjustly smearing an entire religion and undermining the fight against extremism.

“It’s that deliberate, systematic targeting of the Muslim community that really sends chills down my spine,” said Corey Saylor, who directs the Department to Monitor and Combat Islamophobia at the Council on American-Islamic Relations. “Donald Trump has essentially given everyone permission to say the hateful things that they’ve been thinking. . . . Trump has basically mainstreamed Islamophobia.”

For Trump and his aides, 9/11 is a pivotal event when discussing what to do about terrorism.

Republican presidential candidate Donald Trump, left, looks on as a Trump supporter reaches for a sign that reads “Islamophobia is not the answer” at a rally in Oklahoma City on Feb. 26. (Sue Ogrocki/Associated Press)

Until shortly before the attacks, Glassner worked at the World Trade Center offices of the Port Authority of New York and New Jersey. Lewandowski — who was abruptly fired this week as part of a Trump campaign shake-up — had a close friend who died on United Airlines Flight 175, which took off in Boston and crashed into the South Tower; Lewandowski went on to marry his friend’s widow.

Trump was in New York on 9/11, although many of his claims about that day have been dubious or false. Among other things, he has said that he watched from his apartment window as people jumped to their deaths from the twin towers; that he helped clear rubble at Ground Zero, a claim many have challenged; and that he saw “thousands and thousands” of Muslims in New Jersey publicly celebrating the destruction, a story that has been widely debunked.

‘Complete shutdown’

The discussions of a potential Muslim ban began after the Islamic State-linked mass shootings in Paris that killed 130 people on Nov. 13, aides said. By Dec. 2, when a couple inspired by the Islamic State shot 14 people to death in San Bernardino, Trump and his team were ready to announce it.

“The San Bernardino terrorist attack, I think, put an even brighter light on this question about who are these people, how are they getting in, who is checking them, what are their intentions?” Glassner said.

Trump dictated a statement to his spokeswoman, Hope Hicks, who copied it down on a note card that she has saved as a piece of history. For symbolic impact, the campaign decided to wait to announce the proposed policy on Dec. 7, National Pearl Harbor Remembrance Day.

“Donald J. Trump is calling for a total and complete shutdown of Muslims entering the United States until our country’s representatives can figure out what is going on,” he said in the statement. He added later, “It is obvious to anybody the hatred is beyond comprehension.”

The backlash began immediately. Hicks was flooded with questions from reporters, and his primary rivals pounced. Former Florida governor Jeb Bush declared that Trump was “unhinged,” while New Jersey Gov. Chris Christie called it “a ridiculous position.” Sen. Lindsey O. Graham (S.C.) warned that such rhetoric could endanger U.S. soldiers and diplomats working in the Muslim world.

As Trump and his top aides flew to South Carolina for a rally that evening, several said they worried that they had made a major mistake. But then Trump boarded the USS Yorktown in Mount Pleasant and read his statement to a crowd heavy with members of the military. The audience went crazy.

As Trump got into the car after the rally that night, he told his staff: “Well, there’s your poll. That’s how people feel about this.”

Trump added a series of exceptions to his “total and complete shutdown” in the days that followed. The ban would be temporary, he said, and it would not apply to American Muslims, members of the military or prominent foreign Muslims such as athletes, dignitaries or world leaders.

Trump’s anti-Muslim rhetoric has ranged widely. For instance, he has long stoked the idea that Obama might be a secret follower of Islam. Two months before proposing the ban, Trump announced he would kick all Syrian refugees out of the country and bar any others from coming in because they could be a “Trojan horse.” Trump also suggested killing the innocent relatives of terrorists.

“I’ve had good instincts in life, and a lot of this is instinct,” Trump said. He added that three of his Republican primary rivals “confidentially” told him that they agreed with the ban but could not publicly endorse it.

Post-Orlando redoubling

By February — after losing the Iowa caucuses and winning the New Hampshire primary — Trump focused on the next contest, in South Carolina. The night before the primary, he told an apocryphal tale that he would return to repeatedly about U.S. Gen. John J. Pershing fighting Muslim insurgents in the Philippines in the early 1900s.

“He took 50 men, and he dipped 50 bullets in pigs’ blood,” Trump said. “. . . And he had his men load his rifles, and he lined up the 50 people and they shot 49 of those people. And the 50th person, he said: ‘You go back to your people, and you tell them what happened.’ And for 25 years, there wasn’t a problem.”

Lewandowski said in an interview before his firing that the telling of the story was planned ahead of time. He said that it does not matter that it is not true.

“It’s not about that,” he said. “Look, it’s an analogy.”

Soon after Trump became his party’s likely nominee in early May, he seemed to soften his position on the Muslim ban, saying that all of his proposals are just “suggestions” open to negotiation.

But his tone changed again on June 12, when Omar Mateen walked into the Pulse nightclub in Orlando and opened fire, killing 49 people in the worst mass shooting in U.S. history. Mateen, who was born in New York and whose parents are from Afghanistan, had declared his allegiance to the Islamic State.

Trump revived his call for the ban, blamed Muslim communities for not turning in terrorists and accused likely Democratic presidential nominee Hillary Clinton of wanting “to allow radical Islamic terrorists to pour into our country” to enslave women and murder gays.

“Many of the principles of radical Islam are incompatible with Western values and institutions,” Trump said in a scripted policy speech June 13. “We need to tell the truth also about how radical Islam is coming to our shores. And it’s coming.”