Poor President Obama. He had a perfect plan — to use his final UN speech Tuesday to secure his reputation for putting Globalism First. He would preen to the assembled autocrats and bureaucrats about forcing America to take in a record number of refugees, and blast Donald Trump for putting America First.

Hillary Clinton also had a perfect plan. She would keep attacking Trump and his supporters as dangerous and deplorable in hopes that she could scare her way into the White House. With Obama playing the race card to help her with black voters, Clinton would wrap her arms ever more tightly around the president and his policies between now and November.

But terrorist bombings and stabbings are great disrupters, especially when they involve both New York and the heartland in a single weekend. The disruption becomes unbearable when the attacks allegedly are carried out by foreign-born Muslims who were welcomed here with open arms, then turned on their generous American hosts.

Events have a voice and a vote, and the terrorism in Minnesota, New Jersey and New York is scrambling the presidential campaign. It also revealed Mayor Putz to be a horse’s ass as he twisted himself into a pretzel to deny calling the Manhattan bomb a bomb and terrorism terrorism. New Yorkers know that when a bomb goes off on a public street and another one is disarmed nearby, it’s terrorism, stupid.

While the scramble for political safe spaces is still under way, the advantage so far clearly belongs to Trump. His gut instinct to call the Saturday bombings what they were, combined with his demand that refugees and immigrants from countries with a history of terrorism be given tougher scrutiny, fit the nation’s mood and the facts.

Is there any doubt he’s right when he says political correctness has handcuffed law enforcement and that more attacks are coming? Or that his backing by numerous law enforcement groups reciprocates his support for them? It is a potent message when Americans believe they are less safe than they were eight years ago.

The result of the mayhem and Trump’s boldness is that Obama and Clinton are playing defense. The president hoped to avoid saying anything Monday, no doubt viewing the attacks as a distraction from the lofty thoughts he wants to express at the UN, but events forced him out of his hidey hole.

His press secretary inadvertently added to the pressure with one of the dumbest statements possible. Josh Earnest declared that America is in a “narrative battle” with the Islamic State, as though it’s a war of words.

Right, we throw adjectives and they throw bombs.

When Obama did speak, he was perfunctory, warning the media not to rush to judgment and refusing to call the bombings terrorism, though he did say the Minnesota stabbings were a “potential act of terror.”

“Potential”? The Somali-born attacker reportedly referenced Allah, and the Islamic State hailed him as one of its “soldiers.” Of course, if he had used a gun, Obama would have lectured about gun control.

As it was, the president shifted into platitudes about the nation not being shaken, blah, blah, blah. It’s nice to say and think, but it’s simply not true.

Where is my family, where are my friends — that’s what every sensible person thinks when a bomb goes off or the shooting starts. Given the Islamic State’s barbarism and the damage that an inspired individual or small cell can inflict, fear is not just inevitable, it’s rational.

The country is shaken, afraid that terrorism is the new normal and that our political leadership is too timid to defeat it. Granted, it’s a difficult enemy, but hardly on the level of Nazi Germany or fascist Japan.

That fed-up mood is a burden for Clinton because she is so linked to Obama. Her apologists keep promising that her inner hawk will surface and she will move away from Obama on national security, but she either didn’t get the memo or can’t recall it.

Instead, she camouflages her predicament by turning up the rhetoric on the risks of Trump, saying recently that the Islamic State prays, “Please, Allah, make Trump president.” She went there again Monday, calling her opponent “a recruiting sergeant for the terrorists.”

It’s catnip for the left-wing media, but her own answer to the challenge falls far short. She demanded that Americans show “courage and vigilance,” and not demonize Muslims. That’s all she’s got?

In fact, that’s exactly what most Americans have been doing for 15 years, and because it’s not sufficient, they want the next president to get tougher on terrorism. Trump pledges he will, while Clinton sounds a wobbly, uncertain note. She’s the one who needs to show courage.