Democratic presidential candidate Hillary Clinton has long been the strong favourite to beat Republican nominee Donald Trump and win the US presidency. But the Clinton campaign has always been worried that its candidate's progress to the White House is vulnerable to a sudden shock, such as a major terrorist attack in the United States.
Now, just such an attack has taken place with the mass murder of nearly 50 people at Pulse, a gay nightclub in Orlando, carried out by a killer who claimed to be inspired by the Islamic State in Iraq and Syria (ISIS).
Mr Trump moved swiftly to make political capital from the killings. "Appreciate the congrats for being right on radical Islamist terrorism," he tweeted, adding in a later statement: "I said this was going to happen - and it is only going to get worse... We can't afford to be politically correct any more."
The Republican candidate argued that the killings vindicated his call for a temporary ban on Muslims entering the US, and accused Mrs Clinton and the Democrats of planning to increase immigration into the US from the Islamic world.
Mr Trump's critics were quick to accuse him of unseemly opportunism. They also pointed out that a ban on Muslims entering the US would have done little to prevent the Orlando killings, since the murderer, Omar Mateen, was an American citizen who was born in the US.
Nonetheless, it is highly likely that the killings will give the Trump campaign a boost. The fear and suspicion of the Muslim population living in the US - which Mr Trump has appealed to - is now bound to increase.
This is the third mass shooting in recent years perpetrated by radicalised American Muslims. The first was at an army base in Fort Hood in 2009, when 13 people were murdered. The second was the shooting in San Bernardino in December last year, when there were 14 fatalities. The San Bernardino killings gave the Trump campaign an early boost and led to his controversial call for a "total and complete shutdown" on Muslims entering the US.
At the time, some argued that this proposal was so outlandish and racist that it could only damage the Trump campaign.
But, in fact, one recent poll (for YouGov) suggested that a slim majority of Americans approve of the proposal for a "Muslim ban" and that number is likely to rise in the wake of the Orlando killings.
Mr Trump may also benefit from the initial reaction of President Barack Obama to the massacre at the Pulse nightclub. Mr Obama spoke about the necessity of gun control but did not talk about radical Islam. Mr Trump's statement went as far as arguing that the President should be compelled to resign for his failure to say "Radical Islam".
Mr Obama's supporters will argue that the President's restraint was appropriate, given that the facts about the killing were only just emerging. The Democrats can also point out that there have, sadly, been many mass killings in the US in recent years - and the great majority of them have had nothing to do with radical Islam.
The prevalence of mass killings in the US suggests that focusing on the ease with which disturbed individuals can purchase assault rifles is the most obvious response to Orlando. But Republicans are, as always, resisting that logic and arguing, for their part, that gun control in Europe did not prevent the massacre at the Bataclan nightclub in Paris last year.
As well as simply reiterating his demands for a ban on Muslims entering the US, Mr Trump will use the Orlando killings to develop two other favourite themes.
The first is that American elites are blinded by "political correctness", which has led them to endorse allegedly disastrous policies out of misguided liberalism. He will use recent high levels of immigration to the US from Muslim countries as exhibit one for this argument.
The Muslim population of the US is now thought to be 3.3 million, or about 1 per cent of the population. The Obama administration's call for the US to admit more refugees from the Syrian conflict is cited by Mr Trump as evidence of this "politically correct" madness.
The fact that the killers in Orlando and Fort Hood, and one of the murderers in San Bernardino, were American-born will be turned on its head, to cast doubt on the idea that Muslims will integrate into the US, in the same manner as previous generations of immigrants.
This argument by Mr Trump is also likely to resonate in Europe, where Germany's decision to admit more than one million refugees last year, mainly from Muslim countries, has provoked widespread unease about the future stability of German society.
The optimistic arguments made by German Chancellor Angela Merkel about the assimilation of the newcomers will certainly come under further scrutiny after the Orlando killings.
The most immediate consequences, however, will be felt in the US. The presidential election is still five months away, so it is too soon to judge whether the Orlando killings will permanently change the momentum of the campaign. But Mr Trump is the candidate of fear and anger. And both emotions are now soaring in the wake of the massacre at the Pulse nightclub.
THE FINANCIAL TIMES