BAGHDAD – A U.S. airstrike killed Iranian Quds Force commander Qasem Soleimani in Baghdad on Thursday, the Pentagon said, a dramatic escalation of tensions between the two countries that could lead to widespread violence in the region and beyond.

Defense Secretary Mark Esper said the Pentagon had taken “decisive defensive action” against Soleimani, the revered military figure who was closely linked to a network of armed groups backed by Iran across the Middle East and, according to the United States, bore responsibility for hundreds of American deaths.

“Gen. Soleimani was actively developing plans to attack American diplomats and service members in Iraq and throughout the region,” Esper said in a statement. “This strike was aimed at deterring future Iranian attack plans.”

Earlier, Iraqi militia officials and the country’s state TV channel announced that Soleimani had been killed in an airstrike alongside a top Iraqi militia leader just outside the country’s main airport. The Iraqi, Jamal Jaafar Ibrahimi, who is better known by his nom de guerre, Abu Mahdi al-Muhandis, is closely associated with attacks against the United States dating to 1982.

A video circulated by Shiite militia groups showed the crumpled wreckage of the vehicle in which Soleimani purportedly was traveling accompanied by the sound of wailing. A photograph claimed to show his bloodied, ash-strewn hand wearing the same blood-red ring seen in earlier photos of him alive.

Senior officials with the Popular Mobilization Forces (PMF), as the Iraqi militia groups are known, lamented the deaths in messages circulating on WhatsApp. “May God reward you for the loss of the brave leaders, Hajj Soleimani and Hajj Muhandis. May God accept them as martyrs in his vast mercy,” wrote Ahmed al-Assadi, the chief spokesman of the Popular Mobilization Forces, many of which are seen as being funded and directed by Iran.

A U.S. official, who like others spoke on the condition of anonymity because he was not authorized to comment on the record, said the attack was conducted by a U.S. drone and struck a two-car convoy carrying Soleimani and at least half a dozen others on an access road near Baghdad International Airport. The Iraqi government did not make an immediate comment about the attack.

Despite a long period of increasing tension between Iran and the Trump administration, which has vowed a tougher stance on Tehran’s support for proxy groups, the attack against such a key figure in Iran’s security establishment came as a surprise to many analysts, in part because it was seen as likely to ignite a significant Iranian response.

Ilan Goldenberg, who worked on Middle East issues during the Obama administration, characterized the move as a “massive game changer” in the region.

“Iran will seek revenge. It may escalate in Iraq, Lebanon, the gulf or elsewhere. It may attempt to target senior U.S. officials,” said Goldenberg, now a scholar with the Center for a New American Security. “Unfortunately, I highly doubt the Trump administration has thought out the next step or knows what to do now to avoid a regional war.”

The strike appears to have been set in motion by a Dec. 27 rocket attack that killed a U.S. contractor on a base in the Iraqi city of Kirkuk, an assault the Pentagon blamed on Kataib Hezbollah, an Iraqi militia closely associated with Iran. After the attack, President Donald Trump authorized airstrikes on militia targets in Iraq and Syria, which in turn prompted militiamen to attempt a breach of the U.S. Embassy in Baghdad.

While the episode was defused by Thursday, it laid bare the combustible state of U.S.-Iran ties and the potential vulnerability of American personnel in the region.

Speaking to reporters earlier in the day, Esper said the Pentagon was ready to take military action to preempt militia attacks. “The game has changed,” he said. “And we’re prepared to do what is necessary to defend our personnel and our interests and our partners in the region.”

A U.S. official said discussion of the strike began after the contractor’s death. On Wednesday, Secretary of State Mike Pompeo abruptly canceled a planned trip to Eastern Europe, citing the need to stay in Washington “to continue monitoring the ongoing situation in Iraq and ensure the safety and security of Americans in the Middle East.”

Pompeo wanted to be near Trump to advise him on the ongoing situation, said a senior U.S. official familiar with the matter, speaking on the condition of anonymity to discuss internal matters.

It’s not clear what action the Trump administration will take to protect U.S. diplomats and military personnel from what analysts said was likely Iranian retaliation for the attack.

Officials said they were taking steps to defend Americans. “We’re well aware of the possibility of an Iranian response,” one official said.

Already in the past week, the administration has deployed 750 troops from a special quick-action battalion from the 82nd Airborne Division to Kuwait, a staging ground for forces going into Iraq. About 100 Marines were sent into Baghdad to protect the embassy after the militia siege.

About 5,000 U.S. troops are stationed in Iraq as part of efforts to combat the remnants of the Islamic State and support Iraqi security forces. While the number of diplomats there is far fewer than it has been in past years, hundreds of embassy personnel were forced to shelter in safe rooms during this week’ militia siege.

In Baghdad, according to officials familiar with the situation, diplomats at the sprawling U.S. Embassy began packing bags in the event of a potential evacuation order.

An official at Iraq’s elite counterterrorism force said it had been ordered to close all entrances to the Green Zone in Baghdad that houses major government ministries and foreign embassies and to deploy inside it.

Earlier on Thursday, Gen. Mark Milley, chairman of the Joint Chiefs of Staff, said the embassy compound, which contains hardened offices and residences and occupies more than 100 acres in Baghdad’s international zone, remained secure.

“There is sufficient combat power there, air and ground, that anyone who attempts to overrun that will run into a buzz saw,” Milley said.

Tensions between the United States and Iran have been steadily building over the past year. The Trump administration withdrew from the Iran nuclear deal in 2018 and has since imposed new sanctions that have devastated the Iranian economy. In June, Trump authorized and then called off airstrikes in Iran after Tehran’s downing of an American surveillance drone.

Friday’s airstrike is likely to further strain U.S. relations with the Iraqi government, which includes senior officials seen as having strong allegiances to Tehran and which has been pulled between its chief Western ally and its powerful neighbor to the east.

The Iraqi government has been in crisis for months amid massive popular protests focused on widespread corruption and, to a lesser extent, Iranian influence in Iraq. The mass mobilizations prompted Prime Minister Adel Abdul Mahdi to resign late last year, though he remains in office in a caretaker capacity.

Oil prices jumped on Asian markets, which were open when reports of the attack surfaced. U.S. crude oil rose about 1.2 percent initially, while Brent crude, more commonly used around the world, rose 1.3 percent. Oil futures on the New York Mercantile Exchange spiked even higher, with U.S. oil prices jumping as much as 4 percent for a February delivery.

– – –

Sly reported from Beirut. Ryan and Hudson reported from Washington. Lamothe and The Washington Post’s Shane Harris and Carol Morello contributed to this report from Washington.