The administration has compiled a list of statistics to show Iran’s continued funding of extremist groups throughout the Middle East: $700 million to Hezbollah in Lebanon; more than $100 million a year to Hamas and Palestinian Islamic Jihad; at least $16 billion to allies and proxies in Syria, Lebanon and Iraq.

Iran’s increased aggressiveness in Iraq, several experts said, is a direct response to the economic campaign that Mr. Trump is waging against Iran’s government. For now, Iran’s leaders have decided to remain in the nuclear deal, even with the sting of the sanctions. Experts say they are gambling that Mr. Trump will either be crippled by Republican losses in the midterm elections in November or swept out of office in 2020 — or both.

But as Robert Malley, who helped negotiate the Iran deal in the Obama administration, put it: “If the Trump administration is declaring economic war on them, they will react in some way. One of the ways is to radicalize their foreign policy, particularly in Iraq.”

Beyond warning that “America will respond swiftly and decisively in defense of American lives,” the White House offered no details about how the United States would retaliate against Iran for the attacks in Iraq. Officials at the Defense Department said there were no increased military preparations. Striking back, they warned, could provoke asymmetric attacks against American military and civilians by Iranian proxies elsewhere.

A Pentagon spokesman, Cmdr. Sean Robertson, referred all questions to the White House.

When Defense Secretary Jim Mattis served as commander of the military’s Central Command during the Obama administration, he blamed Iran for deadly attacks by Shia militias in Iraq. He advocated confronting Iran, a position that put him at odds with Mr. Obama, who was then trying to engage Iran diplomatically.

In the Trump administration, however, Mr. Mattis has taken a more moderate line. He joined former Secretary of State Rex W. Tillerson in trying to persuade Mr. Trump not to leave the nuclear deal, and has used more measured language.

Moreover, the situation in Iraq is complicated; Iran, too, has been a target of violent protests. In the southern city of Basra, where rockets struck an airport complex that houses the United States Consulate, crowds ransacked and burned the Iranian Consulate. Some people have accused the United States or Saudi Arabia of being behind that attack.