WASHINGTON (AP) — With a single drone strike, President Donald Trump did more than just take out an avowed enemy of the United States. He may have have also upended a central element of his foreign policy.

The Friday strike that killed the most prominent Iranian general may have ended any chance that he would get the United States out of the “endless wars” in the Middle East that he has railed against since taking office.

The killing of Gen. Qassem Soleimani in Baghdad has the world bracing for a possible retaliation, with many fearing it could lead to a wider conflict.

“It is probably the most profound escalation that the United States could have taken,” said Ned Price, who served on the National Security Council under President Barack Obama.

Trump has been on a confrontational path with Iran since even before he took office, when he pledged to end the Iran nuclear deal signed by Obama. He insisted he doesn’t want war and the killing of Soleimani wasn’t meant to provoke the Islamic Republic.

“We took action last night to stop a war,” Trump sad. “We did not take action to start a war.”

Nonetheless, the targeting of Soleimani, the head of Iran’s elite Quds Force, was arguably the most provocative military action in the Middle East since President George W. Bush launched the 2003 Iraq war to topple Saddam Hussein.

The killing of Soleimani, regarded as the second most powerful official in Iran, came as Trump has sought to apply increased pressure on Iran through economic sanctions to abandon its nuclear weapons program, while Iran has countered with provocative attacks on U.S. military and oil facilities in region.

By taking out Soleimani, Trump signaled to Iran that his patience has worn thin over the long, simmering conflagration.

The shadowy general who was in command of Iran’s proxy forces was responsible, according to the Pentagon, for the deaths of hundreds of American troops in Iraq during the height of the war there. White House officials said Trump decided to take action because Soleimani was plotting unspecified future attacks targeting Americans as tensions between the U.S. and Iran have reached a boil.

Trump said Friday he wasn’t interested in further escalating the conflict, but warned the regime that his military advisers have already drawn up plans to retaliate should Iran attack.

“If Americans anywhere are threatened, we have all of those targets already fully identified and I am ready and prepared to take whatever action is necessary, and that in particular refers to Iran,” Trump said.

Trump’s aggressive approach with Iran is remarkable considering his oft-repeated desire to avoid expensive military entanglements. His aversion to long-term military presence has led to him butting heads with his top advisers as he has sought to end the U.S. military presence in Afghanistan and Syria.

Yet, for much of his nearly three years in office, Trump has buffeted between demonstrating restraint and sending warning flares to Iran that the U.S. is prepared for military confrontation.

In June, after Iran shot down a U.S. drone, Trump said he gave top Pentagon officials permission to carry out military strikes against Iran before changing his mind 10 minutes before the operation was to be carried out.

Trump said he had a change of heart after being told by a general that the strikes would cause up to 150 Iranian casualties.

In September, with French President Emmanuel Macron serving as a go-between, Trump reportedly made an unsuccessful attempt to persuade Iran President Hassan Rouhani to speak with him by phone from the sidelines of the U.N. General Assembly.

The next month the Pentagon announced it was deploying 3,000 U.S. troops to protect Saudi Arabia. (The Pentagon on Friday announced following Soleimani’s killing that it would boost its presence in the region with an additional 3,500 U.S. troops.)

The October boost in forces came after a drone attack on a Saudi oilfield. Iranian-backed Houthi rebels claimed responsibility for the attack, and Secretary of State Mike Pompeo accused Iran of being behind “unprecedented attack on the world’s energy supply.”

The tit-for-tat between the U.S. and Iran rose to a whole new level in recent weeks.

Last week, after months of massive street protests in Baghdad by demonstrators urging both Iran and the U.S. to cease interfering in Iraqi affairs, the Iran-backed Kataib Hezbollah group fired a barrage of rockets at a military base in Kirkuk, killing a US contractor and wounding several US and Iraqi troops.

On Sunday, Trump struck back with airstrikes on Iran-affiliated militia bases in western Iraq and Syria.

Then on Tuesday pro-Iranian militia members marched on the U.S. embassy in Baghdad, leading to diplomats holing up in the sprawling compound as protesters burning the embassy’s reception.

Still, before attending a New Years Eve party at his Mar-a-Lago resort, Trump told reporters that he didn’t see war coming and that he wanted peace with Iran. The president, however, warned that if the U.S. were to go to war with Iran it “wouldn’t last very long.”

Less than 48 hours later, Trump ordered the strike that took out Soleimani.

“President Trump may be genuine in not wanting war with Iran,” Price said. “At the same, it is fair to say that he doesn’t seem to understand the implication that an action like this could foretell.”

James Carafano, a national security analyst at the conservative Washington think tank Heritage Foundation, argues that that there’s no disconnect between Trump’s disdain for endless wars and his efforts to increase pressure on Iran.

“This is clearly not an escalation, this is clearly an act of self-defense,” Carafano said. “The president has also never said we’re walking away from the Middle East. What he says he wants is a sustainable security architecture in place which means we’re going to protect our interest and we’re going to expect others to do more to protect theirs.”

Iran says it is already plotting revenge.

Supreme Leader Ayatollah Ali Khamenei warned that “harsh retaliation is waiting” for the U.S. after the airstrike and called Soleimani the “international face of resistance.”

As thousands of worshipers in the Tehran took to streets after Friday prayers to condemn the killing and chant “Death to deceitful America,” the State Department issued an alert urging American citizens to leave Iraq “immediately.”

Over the course of presidency, Trump’s hawkishness on Iran has lacked coherence and has, in no small part, been informed by his desire to do away with the fragile peace brokered by Obama, said Abbas Kadhim, a Middle East analyst at the Atlantic Council in Washington.

Trump won the White House after pledging as a candidate to undo the Obama-administration brokered agreement to limit its uranium enrichment program in exchange for an easing of sanctions. He and other critics felt the deal gave too many economic benefits without doing enough to prevent Iran from eventually developing a nuclear weapon.

Trump followed through on his campaign vow in May 2018 by officially withdrawing from the treaty and reimposing crippling sanctions on Tehran.

“He exited from the deal because it was an Obama deal, and he did believe in his heart of hearts that he could come up with a better a deal,” Kadhim said. “He thought Iran would now be facing the greatest dealmaker. But I think he miscalculated the stubbornness of the Iranians.”