President Obama saved the breakthrough for the final moments of his Israel trip: He persuaded Prime Minister Benjamin Netanyahu to apologize to Turkey for the 2010 Israeli naval raid on a Gaza-bound aid ship.

Netanyahu had long resisted the demand by Turkey’s Islamist prime minister, Recep Tayyip Erdogan, that he formally apologize for a raid in which nine Turks were killed. And rightly so: Even a UN-sponsored investigation determined that Israel’s action was legal under international law.

But Turkey broke off relations, expelled Israel’s ambassador and launched a trial in absentia of top Israeli military officials — which Erdogan has now canceled. Not only that, but after the phone call from Netanyahu, the two agreed they should resume diplomatic relations.

What gives? Short answer: Syria and Iran.

Israel and Turkey are both threatened by Syria’s chaos and Iran’s pursuit of nukes.

Longer answer: The apology is hardly the spur-of-the-moment decision it seems to be. Obama has been pressuring both sides to end the crisis; Israel and Turkey have been in secret talks; last month, Israel supplied advanced electronic warfare systems to Turkey’s air force, and just last week Turkey reportedly signed a strategic agreement with the Kurdish underground, which has bases in Syria.

Ironically, yesterday’s reconciliation may have been helped by Erdogan’s recent condemnation of Zionism as a “crime against humanity.” He reportedly was so taken aback by Washington’s strong criticism that he rushed to make public amends.

Let’s hope it all adds up to a more united front against Tehran and Damascus.