The order, which administration officials said was drafted without the input of Defense Secretary Jim Mattis and Middle East experts at the State Department, has offended the Iraqis in several respects.

During the Bush administration, the United States and Iraq signed a Strategic Framework Agreement, which calls for close diplomatic, economic and security ties and is still in effect.

“If I were an Iraqi, I would be waving this signed agreement in the face of the current administration,” said Ryan C. Crocker, who negotiated the accord and served as the United States ambassador to Iraq under Presidents George W. Bush and Barack Obama. “It is totally inconsistent.”

Iraqis who are already skeptical about Washington have also seized on the order to stir up opposition against the United States. Moktada al-Sadr, the fiery cleric whom many Iraqi Shiites support, accused the United States of “arrogance.”

“So get out U.S. citizens from Iraq before you expel communities from U.S.,” he said on Twitter.

To contain the political damage, officials said a long-planned call between Prime Minister Haider al-Abadi of Iraq and Mr. Trump might be arranged for this week. Mr. Trump spoke on Sunday with King Salman of Saudi Arabia and with the crown prince of the United Arab Emirates, but neither Saudi Arabia nor the Emirates are covered by the new order.

Iraqi officials who are close to the Americans worry that the Islamic State will exploit the policy in its propaganda to recruit new volunteers. As of early Sunday, the terrorist group had made no official pronouncement. However, individual members and supporters have been sharing the order and news articles about it.

Yet another worry has been expressed by veterans, and even members of Mr. Trump’s own party: that the order will interrupt the flow of former Iraqi interpreters and cultural advisers who have worked closely with the Americans and have sought special visas to move to the United States for their own protection.