WASHINGTON (Reuters) - U.S. President Donald Trump took sides in a deep rift in the Arab world on Tuesday, praising Middle East countries’ actions against American ally Qatar over Islamist militants even though the tiny Gulf state hosts the largest U.S. air base in the region.

Trump wrote on Twitter that his recent trip to the Middle East was “already paying off” and cast an anti-Islamist speech he made in Saudi Arabia as the inspiration for a decision by Arab powers to sever ties with Qatar in protest at what they say is the Gulf nation’s support for terrorism.

“So good to see the Saudi Arabia visit with the King and 50 countries already paying off. They said they would take a hard line on funding extremism, and all reference was pointing to Qatar. Perhaps this will be the beginning of the end to the horror of terrorism!” Trump wrote on Twitter.

Qatar vehemently denies the accusations.

Trump later spoke by phone with Saudi King Salman and stressed the need for Gulf unity, a senior White House official said.

“His (Trump’s) message was that we need unity in the region to fight extremist ideology and terrorist financing. It’s important that the Gulf be united for peace and security in the region,” the senior official told Reuters.

U.S. officials were blindsided by Saudi Arabia’s decision to sever diplomatic ties with Qatar in a coordinated move with Egypt, Bahrain and the United Arab Emirates (UAE), current and former officials in Washington told Reuters. The United States was not informed of the decision until just before it was announced, the State Department said.

Even as Trump applauded the Arab countries’ move, the Pentagon on Tuesday renewed praise of Qatar for hosting U.S. forces and its “enduring commitment to regional security.”

Some 8,000 U.S. military personnel are stationed at al Udeid in Qatar, the largest U.S. air base in the Middle East and a staging ground for U.S.-led strikes on the Islamic State militant group that has seized parts of Syria and Iraq.

U.S. Defense Secretary Jim Mattis spoke on Tuesday by phone with his Qatari counterpart, a Pentagon spokesman said, without disclosing the details of their discussion.

Trump’s tweet appeared at odds with comments from U.S. officials who had said on Monday that the United States would quietly try to calm the waters between Saudi Arabia and Qatar because Qatar is too important to U.S. military and diplomatic interests to be isolated.

Qatar has for years parlayed its enormous gas wealth and media strength into broad influence in the region. But Gulf Arab neighbours and Egypt have long been irked by its maverick stances and support for the Muslim Brotherhood, which they regard as a political enemy.

Saudi Arabia’s foreign minister said on Tuesday that Qatar needed to take several steps, including ending its support of Palestinian militant group Hamas and the Muslim Brotherhood, to restore ties with other key Arab states, which also cut transport links.

“We’ve decided to take steps to make clear that enough is enough,” Adel Al-Jubeir told journalists in Paris. He said the “fairly large cost” on Qatar’s economy would convince it to change its policies.

The campaign to isolate Qatar disrupted trade in commodities from crude oil to metals and food, and deepened fears of a possible shock to the global natural gas market, where it is a major player.

Qataris crowded into supermarkets to stock up on goods, fearing shortages.

Maersk MAERSKb.CO, the world's biggest container shipping line, said it was unable to transport goods in or out of Qatar because it could not take them through the UAE port of Jebel Ali.

Slideshow ( 10 images )

Jordan joined the pressure on Qatar, downgrading its diplomatic representation and revoking the license of Doha-based TV channel Al Jazeera.

MEDIATION AND CONSEQUENCES

White House spokesman Sean Spicer said the United States is communicating with all the parties in the Middle East “to resolve issues and restore cooperation” over the Qatar dispute.

“The U.S. still wants to see this issue de-escalated and resolved immediately, in keeping with the principles that the president laid out in terms of defeating terror financing and extremism.”

Slideshow ( 10 images )

Kuwait’s Emir Sheikh Sabah Al-Ahmad Al-Jaber al-Sabah flew to Saudi Arabia for talks with King Salman bin Abdulaziz, Saudi and Kuwaiti state media reported, but gave no details on the discussions.

Russian President Vladimir Putin told Qatar’s emir, Sheikh Tamim bin Hamad al-Thani, in a phone call that crisis situations should be solved by political and diplomatic means, “in dialogue”, the Kremlin said.

The rift has affected global oil prices, hit travel plans and sown confusion among businesses.

Saudi Arabia’s central bank advised banks in the kingdom not to trade with Qatari banks in Qatari riyals, banking sources said.

Oil prices fell on concern that the rift would undermine efforts by OPEC to tighten output.

Foreign Minister Sheikh Mohammed bin Abdulrahman al-Thani told Qatar-based Al Jazeera TV that Qatar would not retaliate, hoping Kuwait would help resolve the dispute.

“We are willing to sit and talk,” he told CNN later, and said his country was “protecting the world from potential terrorists”.

A Qatari official said the rift was pushing Doha in the direction of leaving the six-state Gulf Cooperation Council, “with deep regret”.

The split among the Sunni Muslim states erupted last month after the summit of Muslim leaders in Saudi Arabia, where Trump denounced Shi’ite Muslim Iran’s “destabilising interventions” in Arab lands, where Tehran is locked in a tussle with Riyadh for influence.

Bans on Doha’s fleet using regional ports and anchorages threatened to halt some of its exports and disrupt those of liquefied natural gas.

Traders on global markets worried that Riyadh’s allies would refuse to accept LNG shipments from the Gulf state, and that Egypt might even bar tankers carrying Qatari cargoes from using the Suez Canal as they head to Europe and beyond.

Saudi Arabia's aviation authority revoked the license of Qatar Airways and ordered its offices to be closed within 48 hours. Qatar's stock market slid to its lowest close since January 2016 and the Qatari riyal QAR= came under pressure.

Turkish President Tayyip Erdogan said isolating Qatar, including the use of sanctions, would not resolve any problems. The Muslim Brotherhood has close ties with Turkey’s ruling AK Party, which Erdogan co-founded.

Late on Tuesday, the West African country of Mauritania, a member of the Arab League, severed ties with Qatar over allegations it “supports terrorists”, the state news agency reported.

“The state of Qatar has linked its policies ... in support of terrorist organisations and the propagation of extremist ideas”, said the statement from the ministry of foreign affairs published in Arabic by the Mauritanian Information Agency. “This has resulted in heavy losses to human life in these Arab countries, in Europe and throughout the world”.