President Trump speaks with Qatar's Emir Sheikh Tamim Bin Hamad Al-Than at a hotel in Riyadh, Saudi Arabia, on May 21. (Mandel Ngan/Agence France-Presse via Getty Images)

SAUDIA ARABIA and other autocratic Sunni states have been at odds for years with the energy-rich emirate of Qatar, which hosts the largest U.S. air base in the Middle East. The explosion of those tensions into a diplomatic crisis this week threatens vital U.S. interests in the region, including the military campaign against the Islamic State. So it’s stunning, though perhaps not surprising, that President Trump is claiming credit for the blow-up.

Once again pulling the rug out from under his national security team, Mr. Trump on Tuesday tweeted that the diplomatic and economic boycott imposed on Qatar Monday by Saudi Arabia, Bahrain, the United Arab Emirates and Egypt was the result of his “visit with the [Saudi] King . . . already paying off.” When he spoke there against “funding of Radical Ideology,” the president wrote, “Leaders pointed to Qatar.” Apparently Mr. Trump swallowed their cynical accusations without question: “Perhaps,” he tweeted, the Qatar boycott “will be the beginning of the end to the horror of terrorism.”

Where to start? Mr. Trump’s intervention aligned the United States against a country that is currently hosting at least 10,000 U.S. military personnel at a base where operations against the Islamic State are being directed — a facility that was needed after Saudi Arabia ordered U.S. forces to leave its territory. In backing the Saudis, the president offered unconditional support for a country that has fostered the spread of Islamist extremism across the world and that has supplied many of the foot soldiers for the Islamic State and al-Qaeda — not to mention most of the 9/11 hijackers. He mixed the United States into a Middle Eastern feud that it should be trying to defuse — which is what the professionals at the State Department and Pentagon were trying to do before their boss jumped in.

In reality, neither side in this battle among dictatorships deserves full U.S. support. Qatar stands accused of cutting dirty deals with Iran and aiding al-Qaeda-linked rebel groups in Syria. But what really incenses its Sunni neighbors is its support for popular Islamist political movements such as Egypt’s Muslim Brotherhood, which pursued and won power by democratic means before being ousted in a bloody military coup. Qatar’s policy of keeping open relations with Iran while opposing Iranian aggression in Yemen and Syria was also U.S. policy until five months ago. It recognizes that the uncompromising sectarian conflict promoted by Saudi Arabia will never bring stability to the region.

The demands advanced by the Saudi coalition against their neighbor hardly seem to match U.S. priorities. They reportedly include the shutdown of media outlets such as Al Jazeera that have provided channels for dissident political views in the region , including supporters of democracy and human rights. Qatar is being told it must expel not just political representatives of Palestinian Hamas, who used Doha as a base for negotiations with the rival Fatah movement, but also Muslim Brotherhood figures fleeing Egypt’s bloody repression.

If successful in this showdown, the Middle East’s most reactionary rulers will have taken another step toward shutting down domestic political alternatives, whether moderate Islamists or liberal democrats, and blocking the rapprochement with Iran that ultimately will be needed to end the region’s wars. Worst, they will have succeeded with the help of a U.S. president who seems not to comprehend American interests, nor how he is damaging them.