Moments later, he added, “Perhaps this will be the beginning of the end to the horror of terrorism!”
Qatar has long been accused of funneling arms and money to radical groups in Syria, Libya and other Arab countries. But so has Saudi Arabia. And Mr. Trump’s tweets have huge potential strategic consequences in the Middle East, where Qatar is a crucial military outpost for the United States.
A peninsula that juts into the Persian Gulf, Qatar is home to the forward headquarters of the United States Central Command. It is a major intelligence hub for the United States in the Middle East and the base where the United States plans and carries out airstrikes on the Islamic State.
Qatar has also built deep ties to American academia, providing funding and real estate to build Middle Eastern campuses for six major universities, including Cornell, Georgetown and Northwestern.
Qatar’s financing of radical groups has long been a source of tension with Washington. But the United States has generally avoided taking sides in the regional feuds in the Persian Gulf since it has strategic ties with several of the gulf states.
Mr. Trump’s comments were a sharp break from his top national security aides, who tried to play down any impact of the rift within the Sunni-Arab coalition that is helping the United States fight the Islamic State.
“We certainly would encourage the parties to sit down together and address these differences,” Secretary of State Rex W. Tillerson told reporters in Sydney, Australia, where he and Defense Secretary Jim Mattis were meeting with officials.
Mr. Mattis added, “I am positive there will be no implications coming out of this dramatic situation at all, and I say that based on the commitment that each of these nations that you just referred to have made to this fight.”
Mr. Trump’s tweets also appeared to contradict the American ambassador to Qatar, Dana Shell Smith, who this week retweeted a post of hers saying that Qatar had made “real progress” in curbing financial support for terrorists. Both Qatar and Saudi Arabia have been previously accused of support for extremist militants.
At the Pentagon, some Defense Department officials said they were taken aback by Mr. Trump’s decision to thrust the United States into the middle of a fight with its close partners, particularly given the American military’s deep ties to Qatar.
Al Udeid base, outside of Doha, the country’s capital, is home to around 10,000 American troops, and Mr. Mattis made a point of visiting Qatar in April, spending three nights in Doha, where he held meetings with the emir, Sheikh Tamim bin Hamad al-Thani.
Mr. Mattis “reinforced the importance of deepening the U.S.-Qatari strategic partnership and discussed shared security interests, which include the defeat of ISIS,” the Pentagon said in its statement about the meeting, using another name for the Islamic State. The official statement also spoke of the “value of the Qatari support to the counter-ISIS coalition as well as the country’s role in maintaining regional stability and security.”
After the president’s tweets on Tuesday, Capt. Jeff Davis, a Pentagon spokesman, tried to steer clear of the appearance that the United States had taken sides.
“I consider them a host to our very important base at Al Udeid,” he said. “We have no intention of altering our current operations not only in Qatar but anywhere in the G.C.C.,” he added, referring to Gulf Cooperation Council of Sunni states in the region.
Privately, however, several Defense Department officials said that Mr. Trump’s tweets had undercut the Pentagon, particularly given how crucial Al Udeid base is to the war against the Islamic State.
In addition to the military’s combat and intelligence mission based in Qatar, the American end of the “de-confliction” line is there, a conduit for discussions with Russia to try and avoid accidental conflict in the skies above Syria and Iraq.
American officials had been anticipating the Saudi-led move, a Defense Department official said, and had already received reassurance from Qatari officials that the United States would not be shut out of Al Udeid. But that was before Mr. Trump’s Tuesday morning tweets.
“Qatar can certainly make it less convenient to use the base, and the president’s tweets give them reason to flex their muscles and remind the United States just how convenient the base has been for the last 15 years,” said Jon B. Alterman, Middle East program director with the Center for Strategic and International Studies in Washington.
Also Tuesday, the leaders of Kuwait and Turkey offered to play mediation roles in the dispute. President Recep Tayyip Erdogan of Turkey, an important Qatari ally, called his counterparts in Saudi Arabia, Qatar and Kuwait, as well as the Russian president, Vladimir V. Putin, a Turkish presidential official said.
The emir of Kuwait, Sheikh Sabah al-Ahmad al-Jaber al-Sabah, who has not joined the campaign against Qatar, flew to Saudi Arabia on Tuesday for a meeting with the Saudi head of state, King Salman.
Disagreements between Qatar and its gulf neighbors escalated after a series of uprisings against Arab autocrats in 2011. In the power vacuums that came after the uprisings, Qatar backed Islamist groups like the Muslim Brotherhood in Egypt, Syria and Libya — angering Saudi Arabia and the United Arab Emirates, which see the Muslim Brotherhood as a terrorist organization.
Like the Saudis and Emiratis, Kuwait backed the Muslim Brotherhood’s subsequent ouster from power in Egypt in 2013. Analysts said the country had taken a more conciliatory role in this week’s dispute because it was wary of ceding too much influence to the Saudi alliance.
“Kuwait feels that if Saudi Arabia and the Emirates get what they want from Qatar, then Kuwait will be next, too,” said Galip Dalay, research director at Al Sharq Forum, a Turkish think tank.
Turkey publicly maintains that it is not taking sides in the dispute. “Turkey does not get into that — they’re all our Sunni brothers and our friends,” Ilnur Cevik, a foreign policy adviser to Mr. Erdogan, said by phone on Tuesday.
The analysts said in private that Turkey was frightened of losing its best regional ally. Turkey has a military base in Qatar and supports many of the same Islamist groups in the region. Like Qatar, Turkey welcomed Muslim Brotherhood members who fled Egypt after the removal of President Mohamed Morsi in 2013.
“If Qatar gives into this pressure, that will mean that Turkey’s role in the region will be further constrained,” Mr. Dalay said.