On the morning of March 11th, 2004, ten bombs exploded during the morning commute at Madrid’s Atocha train station. One hundred and ninety-two people were murdered and over 2,000 injured. Three days later, the government of Prime Minister Jose Maria Aznar lost power in an election that swung suddenly to the Socialist Party.

The attack, the deadliest in Spain’s history, was seen by many as an al-Qaeda-inspired retaliation for the Aznar government’s support for the already unpopular U.S. invasion of Iraq. In jihadist lore, this is a legendary success story: a terror attack that inspired enough fear to swing a Western election.

This story has been kicking around the back of my cabeza since Donald Trump won the Republican nomination, and I thought of it again after the explosion Saturday night in Chelsea. Demographic math and a basic failure by the celebrity demagogue to reach out beyond his base makes a general election win unlikely but hardly impossible. Trump can’t be counted out until all the votes are counted.

Though he’s a uniquely unqualified candidate, I’ve been concerned about an outside X-Factor event suddenly changing the emotional calculus of the electorate in ways that we would later regret. This could be a sudden economic collapse or a cyber October-surprise. But terrorism has always seemed the prime known-unknown.

After all, terrorism is now a depressingly regular feature of American life. While no attacks have rivaled 9/11, we saw at least 45 thwarted terror plots in the first ten years after the destruction of the World Trade Center and in the last year alone suffered horrific losses in the San Bernardino and Orlando slaughters. But we have no template for the impact of an attack just before an American election.

We are in a long war, a “generational struggle against radical jihadist terrorism,” as Hillary Clinton has repeatedly said. Many attacks have been the result of lone wolves, darkly inspired rather directed by centralized terror organizations, like the Boston bombing. This risk won’t evaporate overnight, no matter who is elected president in less than two months.

Trump has based his campaign on fear and anger of the “other,” most infamously pledging to at least temporarily stop Muslim immigration to the United States (later dialed back to an ambiguous regional restriction). Fear of immigration, especially Muslim immigration, has been a mainstay not only of Trump’s campaign but also his European dopplegangers in UKIP and Le Pen’s National Front Party, which has been buoyed by repeated horrific jihadist attacks from Paris to Nice.

Trump rarely loses an opportunity to exploit terror. Within minutes of initial fog-of-war reports about Saturday night’s explosion in Chelsea, Trump told a crowd in Colorado Springs that a bomb had gone off in New York and while “nobody knows exactly what's going on but, boy we are really in a time—we better get tough folks." Always classy, he then touted a new poll showing him 4-points up.

He has previously tried to make political hay of the San Bernardino and Orlando attacks, with less than successful results. But now we’re 50 days from the election and polls show the race is tightening. To some extent, that’s to be expected.

But after months of primaries and analytic navel-gazing this is real time, with 29 people injured by an explosion in the heart of New York, just a few blocks from The Daily Beast’s headquarters. This came hours after an apparent IED exploded in Seaside, New Jersey, on the site of a U.S. Marine charity race, which had been mercifully delayed, curtailing casualties. There is still much we don’t know about both detonations, but New York City Mayor Bill de Blasio’s statement calling the Chelsea bomb was “an intentional act” but adding “we do not see a link to terrorism.” A Saturday night stabbing of eight people at a mall in St. Cloud, Minnesota, by a man in a security guard uniform was claimed by ISIS on Sunday morning, which issued a statement describing the assailant as "a soldier of the Islamic State." This dark trifecta of weekend incidents one week after the anniversary of 9/11 all add to the drumbeat of anxiety which has driven many voters into the arms of Trump, someone they see as a strong man in chaotic times.

More detailed information will come in over the coming hours and days. But there’s reason to fear this pattern could continue between now and November. Whether it is the work of lone wolves or something more coordinated, it doesn’t take Nostradamus to see that terrorists view President Trump as an asset in their efforts to portray America as discredited and in decline. His divisive instincts play perfectly into ISIS’ attempts to recast what used to be called The War on Terror as a war between America and Islam everywhere, rather than a rag-tag band of extremists, many radicalized remotely, parading under the broad banner of an apocalyptic death cult.

If this pattern continuing sounds unlikely, consider the fact that America’s two biggest geo-political competitors, Russia and China, have been cheering the prospect of a Trump presidency, presumably because they see it as a harbinger of American decline and retreat from the world, despite all the tough guy rhetoric. It’s a helpful bit of historical symmetry that “America First” has consistently symbolized a flag-waving acquiescence to overseas dictators with bloody expansionist ambitions.

The fact that so many of the Republican Party’s national security mandarins have declared Donald Trump unfit for office, should offer a reality check for reflexive Republicans and open-minded independents alike. The latest respected figure to join this chorus was former Secretary of Defense Robert Gates, who wrote in the Wall Street Journal, “on national security, I believe Mr. Trump is beyond repair. He is stubbornly uninformed about the world and how to lead our country and government, and temperamentally unsuited to lead our men and women in uniform…He is unqualified and unfit to be commander in chief."

Against this unflattering backdrop, it’s tempting to say that the hawkish former Secretary of States Hillary Clinton could be in a better position to benefit if, God forbid, terror attacks continue through the election. After all, she has a demonstrated record on national security and far more detailed policy proposals on how to deal with ISIS, (which admittedly isn’t hard given Trump’s laughable talk of a “secret plan” to the win the war.)

But sexism impacts negative perceptions of Hillary Clinton just as racism fueled many of the unhinged criticisms of President Obama, especially the Birther conspiracy theories that Trump did so much to pump up over the past five years. We have no national template for a Golda Meir-type leader in our country. There will be many who are susceptible to the idea that an older woman can’t possible be as tough on terrorism as a blustery old man who loves to declare that he’ll “bomb the shit” out of ISIS. "Strong and wrong" leaders have real emotional appeal during times of crisis. The certainty of the demagogue can be more compelling than the sober strategies offered by statesmen and stateswomen.

As we get more information, it may be that these incidents are not connected with terrorism but the ensuing drumbeat of anxiety only adds to Trump’s desire to declare himself a prophet who warned about terrorism and immigration before it was cool. This all falls into his fear-based wheelhouse.

Terrorism is one of the defining fights of our time. But terror, of course, is designed to elicit fear and change policy and behavior in ways that benefits terrorists. We unfortunately know that a precedent exists for terrorists impacting a western government’s elections. We’ll need to steel ourselves and hope that Americans vote with their head as well as heart on November 8th.