The catastrophic war in Syria is nearing what could be a diplomatic endgame, as the United States, Russia and Israel shape a deal that would preserve power for Syrian President Bashar al-Assad in exchange for Russian pledges to restrain Iranian influence.

Checking Iranian power has become the only major Trump administration goal in Syria, now that the Islamic State is nearly vanquished. President Trump appears ready to embrace a policy that will validate Assad, an authoritarian leader who has gassed his own people, and abandon a Syrian opposition that was partly trained and supplied by the United States.

Trump’s Syria policy has bounced back and forth like a ping-pong ball. The most consistent feature has been his mistrust of Middle East military commitments made by his predecessors George W. Bush and Barack Obama. Step by step, he seems to be undoing them.

The diplomatic discussions about Syria come as Trump prepares for a July 16 summit with Russian President Vladimir Putin. Foreign diplomats and administration officials are unsure just what will be on the agenda, but the Syria package will probably be in play.

An intriguing aspect of the possible Syria deal is that it’s driven by close cooperation between Russia and Israel. The Israeli agenda, like Trump’s, is narrowly focused on blocking Iran — and Israelis seem to have concluded that Putin is a reliable regional partner.

Israeli, European and U.S. experts outlined some likely elements of the framework. In exchange for U.S. withdrawal of its demands for a political transition in Syria, Russia will support various measures to contain Iranian power, including:

● Iranian-backed forces will stay at least 80 kilometers from the Israeli border on the Golan Heights.

● Israel will have tacit Russian permission to attack threatening Iranian targets in Syria, so long as Russian troops aren’t harmed. Israel has exercised this freedom of action in recent weeks to strike secret Iranian bases and block Tehran’s attempt to open a Syrian “second front” against Israel that would complement Hezbollah in Lebanon.

● Assad’s army, backed by Russian air power, will consolidate control in southwest Syria and retake posts on the Jordanian border. Jordan favors Assad’s control of the border because it might allow truck traffic to resume, boosting the cash-strapped Jordanian economy. Opposition forces in the southwest apparently will be left to fend for themselves. As thousands of new Syrian refugees flee toward a closed Jordanian border, a new slaughter of trapped civilians is possible.

● Russian military police will patrol areas of southwest Syria and perhaps other regions, in an effort to stabilize those zones. But a European diplomat cautions that any expectation that Russian power will mean security is “based on wishful thinking rather than reality.” The United States, for now, will retain its garrison at al-Tanf, in southern Syria, to block any Iranian advance there.

● Russia and the Assad regime will expand their outreach to Syrian Kurdish forces in northeastern Syria, in areas where the Kurds have partnered successfully with U.S. Special Operations forces to defeat the Islamic State and restore stability. U.S. commanders hope American troops can remain for 18 more months or so. But Trump has voiced his impatience with this mission.

Syrian opposition leaders are bitterly disappointed at the deal that’s taking shape, and one warned me that the American “betrayal” will be an incubator for future jihadist movements. European countries, which have been key covert allies in Syria, are deeply skeptical that the anti-Iran plan will work. “Britain and France have warned the U.S. that it’s highly improbable that Russia has the presence on the ground to get the Iranians to shift out” of areas they now dominate, a European diplomat told me.

Trump’s willingness to accede to Russian power in Syria — and to give up hard-won U.S. gains — troubles many Pentagon officials, but they seem to be losing the argument.

As Putin makes his way toward the summit stage, it’s worth pausing a moment to appreciate how deftly he has played his hand. Russia is becoming the indispensable regional balancer, playing a role once proudly claimed by the United States. Russia somehow maintains good relations with both Iran and Israel; it has growing ties with Saudi Arabia and the United Arab Emirates; it talks with Syrian Kurds and their bitter rivals in Turkey.

Putin has a reputation as an ex-KGB thug. But his Syrian strategy evokes the subtler Chinese precept of subduing the enemy without fighting. Putin has taken a decisive position in Syria at minimal cost — with a deferential Trump now seeming ready to confirm his victory.