Over the past two weeks, as President Donald Trump has picked fights with Ilhan Omar, Rashida Tlaib, Alexandria Ocasio-Cortez, Ayanna Pressley, and now Elijah Cummings, a consensus has emerged: Trump has begun his reelection campaign. He’s stoking bigotry to motivate his conservative white base.

It makes sense. But if Trump is launching an offensive, he’s also trying to solve a problem: He has less material. Over the course of Trump’s 2016 campaign, the United States and its allies experienced spasms of deadly violence, which helped him convince white Christian Americans that only he could protect them from a supposed threat from Muslims and blacks. Today, although America still experiences plenty of violence—mass shootings, for instance—it’s not the kind that fits Trump’s narrative. So instead of exploiting incendiary events, he has to create them.

In the fall of 2015, Ben Carson was rapidly gaining on Trump in the race for the GOP nomination. “Carson Surges to 9-Point Lead; Trump Slides,” announced an October 23 Des Moines Register headline about a new poll of likely Iowa caucus-goers. “The Doctor Is In as Carson Ties Trump in GOP Race,” announced the press release of a November 4 Quinnipiac poll of Republican voters nationwide.

Then ISIS struck. On November 13, terrorists killed 130 people and wounded more than 400 in Paris. Trump called for a database to track Muslims in the United States. A week later, he boasted that “people look at me as a strong leader. The polls have been very much up since” the attack.

He was right. And it was the beginning of a pattern. For the next nine months, violence kept striking American and European cities. Trump kept responding in reckless, bigoted ways—and profiting at the polls.

On December 2, a married couple in San Bernardino sympathetic to ISIS killed 14 people and injured 22. A few days later, Trump called for a “total and complete shutdown of Muslims entering the United States.” He also noted that “whenever there’s a tragedy … my numbers go way up.” It was true. As FiveThirtyEight’s Nate Silver later noted, Trump’s national poll numbers, which “had stagnated in the mid-to-high 20s in the two months before Paris,” rose to 32 percent after the Paris attacks and 35 percent after San Bernardino. Trump never trailed in the GOP race again.

Then, in late March, suicide bombings in Belgium killed 35 people and wounded more than 300. Trump declared that “I would close up our borders to people until we figure out what is going on” and “do a lot more than waterboarding” to suspected terrorists. As March turned to April, his lead over his closest rivals, Ted Cruz and John Kasich, kept expanding. “I’ve been talking about this simply much more than anybody else,” Trump said in response to the Brussels attacks, “and it’s why I’m probably number one in the polls because of the fact that I say we have to have strong borders.”

The next major jihadist attack occurred on June 12 when Omar Mateen, who had pledged loyalty to the Islamic State, killed 49 people and wounded 53 others at a gay nightclub in Orlando. Trump reiterated his call for a ban on Muslim immigration, and in the days that followed gained modestly on Hillary Clinton in general-election polls.

Finally, on July 8, an African American man seeking revenge for police violence against blacks shot and killed five white policemen in Dallas. Ten days later, when the Republican Convention began, Clinton’s lead—which had averaged six to seven points in June—was down to three points. At the convention, Trump made the attacks a centerpiece of his acceptance speech. “Our convention occurs at a moment of crisis for our nation,” he declared. “The attacks on our police, and the terrorism in our cities, threaten our very way of life.” Trump’s speech used the word murder twice, brutal three times, police five times, crime seven times, killing nine times, and violence 11 times. By the convention’s end, he had a small lead.

Obviously, the ISIS attacks and shootings of police weren’t the only reason Trump won the Republican primary and later the presidency itself. But they likely helped. When exit pollsters asked voters to name their top issue in 2012, terrorism wasn’t even included among the options. In 2016, by contrast, 18 percent called it their top concern. Among those voters, Trump beat Clinton by 17 points.

Since then, terrorism and violence against police have subsided as issues. Major jihadist attacks in the U.S. and Europe have become so rare that Trump has had to invent them. Speaking in Melbourne, Florida, in February 2017, Trump railed against an attack “last night in Sweden” that never actually occurred.

Trump is still trying to portray racial and religious minorities as a threat. Yet the absence of high-profile violence by Muslim or African American perpetrators has forced him to work harder to drive that message home. In the fall of 2017, he castigated NFL players who were kneeling during the national anthem to protest police brutality. But while a majority of Americans disapproved of the anthem protests, they weren’t frightened by them. And there’s little evidence that the issue boosted Trump’s approval ratings.

Then, in the run-up to the midterm elections last fall, Trump focused on the migrant caravan heading toward America’s southern border. The issue did grab the attention of many Republicans, according to surveys. But although voters who prioritized immigration largely voted for GOP candidates, according to exit polls, the much larger percentage who prioritized health care voted overwhelmingly for Democrats.

Now Trump has shifted his target from Central American asylum seekers to black, Latino, and Palestinian members of Congress. It’s not hard to grasp his strategy: He wants to make Omar, Tlaib, and Ocasio-Cortez, who are less popular than other prominent Democrats, the face of their party. He’s also making them symbols of a demographic shift that agitates and mobilizes his base. A 2016 study by political scientists at the University of California at Santa Barbara and Stanford found that telling white Americans that whites would become a racial minority in the United States by 2042 made some of them more likely to vote for Trump.

But while “the squad” isn’t especially popular among voters, most Americans also dislike Trump’s attacks on these congresswomen. His racist jabs don’t appear to have boosted his approval ratings at all.

One reason may be that Trump is so clearly the aggressor. After San Bernardino, Orlando, and Dallas, he couched his authoritarian and bigoted statements as a response to violence. Now his foils are people of color who are merely opposing his agenda in Congress. Given Trump’s success in 2016, it’s no surprise that he keeps trying to link Ilhan Omar to al-Qaeda. Politically, he needs to depict Muslims and people of color as not just wrong, but terrifying. Don’t be surprised if he invents more terrorist attacks between now and Election Day.