RIYADH, Saudi Arabia — With trumpets blaring, cannons booming and fighter jets streaking overhead trailed by red, white and blue contrails, President Trump arrived in the scorching heat of the Arabian desert on Saturday hoping to realign the politics and diplomacy of the Middle East by forcefully reasserting American support for Sunni Muslim countries and Israel against Iran’s Shiite-led government.

The start of Mr. Trump’s first trip abroad since becoming president — coming amid the scandals and chaos engulfing his administration — was intended to be a blunt rejection of President Barack Obama’s vision for the region. Mr. Obama sought a reconciliation with Iran and negotiated a deal intended to keep Tehran from developing nuclear weapons.

The day proved to be almost everything a besieged White House could have wanted. After weeks of stormy politics and out-of-control news cycles, the president stayed rigorously on script and restrained himself on Twitter. His staff boasted about the business deals being signed, and the visual images beamed to Americans back home showed a president seemingly in command of a world stage.

The Saudis treated him like royalty, with red carpets, lavish meals and American flags flying everywhere. They repeatedly used the word “historic” to describe his visit, gave him a medal, projected a multistory image of his face on the side of the palatial Ritz-Carlton hotel where he was staying, and treated him to a colorful dance display in which his staff joined in with scores of white-robed Saudis and even the president swayed back and forth.