Amidst the screaming headlines about “massacre” and “war crimes” and unsettling pictures of Arab casualties, keep in mind the central question: When is it the right time to do the right thing?

That’s the question President Trump faced when considering whether to move the American Embassy to Jerusalem. His three predecessors had used a loophole in the 1995 law requiring the move to give a consistent and increasingly cynical answer of, “Not now, maybe later.”

That dodge lasted 22 years, until Trump cut through the nonsense last December with a statement of resounding moral clarity. Now, he said, is the right time to do the right thing.

It was a singular decision and Monday’s opening of the American Embassy in Jerusalem, the capital of Israel, righted a historic wrong. As both American and Israeli speakers noted, the custom throughout the world and throughout the ages is for foreign embassies to be located in the city designated by the host country as its capital.

And so now the rest of the world is out of step when it comes to Israel — and only Israel. That would be a curious exception if the pattern weren’t so pronounced and the reason so obvious.

The world’s double standard against the Jewish state helps explain the decision by Hamas leaders in Gaza to mix armed terrorists and unarmed civilians and urge them to crash through the border fence. This was murder, and not by Israeli soldiers defending their country against a mass invasion.

The blood of the dead and wounded is on the hands of the merciless Hamas thugs who sent their people on a suicide mission that had zero chance of military success.

But, of course, military success was not the goal. The goal was to get the headlines and pictures the world is seeing, the bloodier the better.

So when The New York Times writes that “Israel Kills Dozens and Wounds 1,700 at Gaza Border,” it’s mission accomplished for Hamas.

Success is getting the usual suspects to gang up on Israel. Indeed, the statements condemning it for a “disproportionate” response didn’t even need to be written anew.

The United Nations and other so-called peacekeepers have issued similar statements for years. Each time Israel is attacked, its response is always faulted. Only the date and details needed to be changed.

But here is what’s different this time: Trump. Because of him, the United States is no longer playing the sympathetic but feckless mediator.

It has taken the side of truth and backs it with its enormous prestige and power. It will not run just because cowardly conventional wisdom says ­it should.

Some Arab nations are also tired of Palestinian rejectionism. Saudi Arabia, Egypt and Jordan, among others, are actually working with Israel to combat Iran and Islamic ­terrorists.

For now, the embassy move certainly advances Israel’s legitimate interests and boosts the popularity of Prime Minister Benjamin Netanyahu, but whether it will advance the cause for peace is up to the Palestinians.

If they seize the opportunity to work with Trump’s team, there is almost certainly a pathway for their own state, as there has been for two decades.

Even some Israelis acknowledge that they will likely have to make new concessions because the next round will favor the Arabs. They recognize that Trump is a deal maker and that he wants to make a Mideast deal almost as much as he wants a deal with North Korea.

In fact, the president has said that he will offer the Palestinians “The deal of the century.”

Sadly, they could make the same mistake again they have made ever since 1948. Up to this very day, they have selected, or accepted, leaders who feed them the Great Lie that Israel can be pushed into the sea, which is why there is yet no Palestinian state.

Meanwhile, Israel is stronger today than it has ever been. It celebrates its 70th anniversary as a vibrant power, defined by its economy, culture and military instead of by hostile ­neighbors.

So perhaps the Palestinians should take their cue from Trump and try something entirely new. They could break the deadlock simply by saying yes for a change.

After all, saying no has gotten them absolutely nowhere.