A day after President Trump signaled he would not use military force to escalate a tense standoff with Iran, that nation’s supreme leader responded with a message of his own: a doctored photo of Trump’s face imprinted with red welts from a slap to the face.

The creation on the official website of Ayatollah Ali Khamenei offered a trolling visual meme to echo his previous warning that Tehran’s missile attack on two Iraqi facilities housing U.S. troops was only the first salvo in a campaign to avenge the drone killing of Maj. Gen. Qasem Soleimani.

The barb took on the juvenile tone found on Internet message boards of the unruly dark Web. But it was a fitting coda in a geopolitical confrontation that escalated rapidly in part through taunting on social media between a U.S. president more comfortable issuing tweets than holding news conferences and an authoritarian regime that, experts said, employs Internet trolling as a cornerstone of a disinformation and propaganda campaign.

Through a two-week crisis that brought the two countries to the brink of a full-on war, Trump and his rivals traded Twitter insults and threats — seeking to one-up each other with clever rejoinders in the virtual world amid bloody consequences in the real one.

In his first public statement after ordering the drone strike on Soleimani, Trump posted a solitary image of an American flag — one that quickly went viral, garnering more than 814,000 likes.

Days later, after Iran’s missile barrage, a senior adviser to Khamenei, Saeed Jalili, mocked Trump by posting an image of Iran’s flag. Conservatives in the United States, including prominent Trump supporters, swarmed to mock Jalili in the comments, posting more images of American flags.

Experts called the display an example of a new era in international diplomacy in which official letters, telephone hotlines and secure video conference calls have been replaced, in some cases, by high-octane and instantaneous social media messaging. The shift has been accelerated by Trump, who has scrapped formal White House briefings in favor of a daily stream of boastful, belittling and bellicose tweets.

“We’re at a unique point in time in which Iran’s senior leadership sees this as a more effective way to communicate a message to the president because the president uses Twitter to message policy and orchestrate threats,” said Jason Blazakis, a professor at the Middlebury Institute of International Studies who served as a counterterrorism official at the State Department from 2008 to 2018.

Blazakis said there have been moments when the social messages might have helped de-escalate tensions, pointing to tweets from Iranian Foreign Minister Javad Zarif and Trump after Iran’s missile attacks that appeared to signal both sides would be willing to halt overt military action. Blazakis also emphasized that there are significant risks to relying on a communication model that is often aimed a provoking the other side.

In July 2018, with Trump engaged in mutual threats with Iranian President Hassan Rouhani, Soleimani shared on Instagram a manipulated image of the White House exploding. The image appeared to have been taken from the 2013 film “Olympus Has Fallen,” and it was doctored so that Soleimani appeared in front of the inferno with a walkie-talkie in his hand.

This week, a senior Iranian adviser to Rouhani, Hesameddin Ashena, tweeted a link to a business magazine profile about Trump’s private properties, including Mar-a-Lago in South Florida and Trump Tower in New York, along with a quote from the late Ayatollah Ruhollah Khomeini — a post some viewed as a threat to those buildings.

“For somebody who makes decisions on gut instincts or emotion, we’re left to wonder: Is the trolling from the Iranians factoring into the decision-making and leading to a situation where [the Trump administration] is engaging in the targeted killing of Soleimani?” Blazakis said. “We’re not in the president’s head, but given his use of social media, maybe those things resonate.”

From the time he announced his presidential campaign, Trump has rewritten the rules of communication for U.S. political figures. Since taking office, he has shown no compunction about mocking rivals, threatening foreign leaders, disseminating false statements and misleading news stories and sharing memes or retweeting accounts run by automated bots or other unreliable sources.

At times in the faceoff with Iran, Trump appeared to be freelancing official U.S. policy through 280-character missives, threatening to attack Iranian cultural sites even as his top Defense officials suggested doing so would violate international law.

He retweeted a post that shared images of Soleimani and former Islamic State leader Abu Bakr al-Baghdadi, who was killed in a U.S. raid in Syria last fall, along with one of Trump winking at the camera.

On Twitter and Instagram, Trump shared a video from Senate Republicans celebrating Soleimani’s death by announcing that his “20-year span of terror is finally over” — with a big red X over his name.

Trump’s tweets racked up some of the highest levels of engagement from his supporters of his tenure, suggesting that the president’s conservative base was rallying behind his projection of Twitter toughness. But critics faulted Trump for, like his adversaries, using social media tools to spread disinformation and propaganda of his own.

“We can all give him credit for being politically astute about what his base is looking for while also being diplomatically dangerous in how he uses these images,” said Jennifer Psaki, who served as White House communications director and a State Department spokeswoman in the Obama administration.

Psaki acknowledged that former president Barack Obama’s team was perhaps “outdated and mechanical” in its use of social media. But, she said, Trump is spreading “inaccurate information at a time when the public is susceptible to that — some are fearful and some will believe anything.”

U.S. social media companies have also been pressed by counterterrorism experts and others to do more to crack down on the exploitation of their platforms by authoritarian regimes, especially those that impose Internet bans on their citizens.

In November, Brian Hook, the U.S. special representative for Iran, called on Facebook, Twitter and Instagram to shut down the accounts of Khamenei, Zarif and Rouhani. Twitter has previously suspended thousands of accounts with ties to the Iranian government but it has not acted against the top leadership.

Trump and his top aides have also peddled in disinformation. The president retweeted a prominent alt-right conspiracy theorist who claimed that Soleimani helped plan the attacks on U.S. facilities in Benghazi, Libya, which killed four Americans in 2012. There is no evidence to support such a claim.

Vice President Pence used a tweet to suggest Soleimani helped facilitate the travel of al-Qaeda terrorists who carried out the Sept. 11, 2001, attacks in New York, Virginia and Pennsylvania. The 9/11 Commission Report concluded there was no evidence that the Iranian government played a role and did not mention Soleimani.

Such statements amount to outright propaganda, said Jennifer Grygiel, an assistant professor of communications at Syracuse University who specializes in social media. Grygiel called Trump’s tactics dangerous and said it was an example of the need for social media companies to employ greater controls — including the pre-screening and moderating of tweets during a crisis.

“Tweets can’t be recalled,” Grygiel said. “They’re like an instant [news] wire. They can move stock markets. Let’s not assume a tweet could not start a war.”