As Americans waited to see how the U.S. would respond to an Iranian-backed Iraqi militia’s embassy attack, Iranian Supreme Leader Ayatollah Ali Khamenei taunted President Trump on Twitter Wednesday — taking Trump on at his own game.

“That guy (President Trump) has tweeted that we see Iran responsible for the events in Baghdad & we will respond to Iran. 1st: You can’t do anything. 2nd: If you were logical — which you’re not — you’d see that your crimes in Iraq, Afghanistan… have made nations hate you,” Khamenei’s official English-language Twitter account posted.

That guy has tweeted that we see Iran responsible for the events in Baghdad & we will respond to Iran.

1st: You can’t do anything.

2nd: If you were logical —which you’re not— you’d see that your crimes in Iraq, Afghanistan… have made nations hate you. https://t.co/hMGOEDwHuY — Khamenei.ir (@khamenei_ir) January 1, 2020

Khamenei’s post scoffed at Trump’s own tweets from the previous day when the American president squarely blamed Iran for the violent and fiery attacks on the Baghdad embassy. Trump said Iran would pay a “very BIG PRICE” for the embassy attack.

“This is not a warning, it is a threat,” Trump said.

Khamenei clapped back with threats of his own on the U.S. president’s preferred platform, tweeting “if anyone threatens that, we will unhesitatingly confront & strike them.”

If the Islamic Republic decides to challenge & fight, it will do so unequivocally. We’re not after wars, but we strongly defend the Iranian nation’s interests, dignity, & glory. If anyone threatens that, we will unhesitatingly confront & strike them. — Khamenei.ir (@khamenei_ir) January 1, 2020

Tehran has denied that it orchestrated the attack on the Baghdad embassy.

The Twitter battle is a tactic by Iranian officials who use “social media platforms restricted in their own country to inject vitriol into foreign and domestic policy debates,” said Behnam Ben Taleblu, a senior fellow from national security and foreign policy think tank Foundations for Defense of Democracies.

Tensions between the U.S. and Tehran have steadily risen since Trump withdrew the U.S. from Iran’s 2015 nuclear deal and embarked on a campaign of maximum pressure through economic sanctions. Iran has responded by abandoning some of its commitments under the deal.

U.S. officials have blamed Iran for the sabotage of oil tankers in the Persian Gulf and a drone attack on Saudi oil facilities in September that caused a spike in world oil prices. But the Trump administration has not responded with direct military action, apparently fearing a wider conflict.

Hussein Ibish of the Arab Gulf States Institutes said Iran is “calling the U.S.’s bluff” as it escalates its attacks despite Trump’s threats of war and retaliation.

“Trump fell into Iran’s trap really badly,” Ibish said, explaining he believes the U.S. should have retaliated directly against Iran for the death of an American contractor rather than hitting the militia. “Iran has been launching attacks in a deniable way to see if (Trump) is bluffing and the answer so far is yes.”

The two days of rioting at the Baghdad embassy were a response to weekend U.S. airstrikes on an Iran-backed militia that Washington said was responsible for the rocket attack that killed a U.S. civilian contractor. The U.S. strikes killed 25 members of the Iranian-backed Ketaeb Hezbollah militia group ramping up public outrage in Iraq at the strikes, which were seen as a violation of Iraqi sovereignty.

The New Year’s Eve breach of the largest and one of the most heavily fortified U.S. diplomatic missions in the world is the most serious attack on a U.S. diplomatic property since the attack on the Benghazi compound in 2012 that left Ambassador Christopher Stevens and three security contractors dead. Then-President Barack Obama and Secretary of State Hillary Clinton were criticized for their response. Trump tweeted Tuesday, “The Anti-Benghazi!’

Herald wire services contributed to this report.