– The United States and Iran exchanged escalating military threats on Friday as President Donald Trump warned that he was "prepared to take whatever action is necessary" if Iran threatened Americans and Iran's supreme leader, Ayatollah Ali Khamenei, vowed to exact vengeance for the killing on Trump's order of Iran's most valued general.

Although the president insisted that he took the action to avoid a war with Iran, the continuing threats further rattled foreign capitals, global markets and Capitol Hill, where Democrats demanded more information about the strike and Trump's grounds for taking such a provocative move without consulting Congress.

Democrats also pressed questions about the attack's timing and whether it was meant to deflect attention from the president's expected impeachment trial this month in the Senate. They said he risked suspicion that he was taking action overseas to distract from his political troubles at home, as in the movie "Wag the Dog."

But Trump, speaking to reporters in a hastily arranged appearance at Mar-a-Lago, his Florida resort, asserted that Maj. Gen. Qassem Soleimani, who directed Iranian paramilitary forces throughout the Middle East, "was plotting imminent and sinister attacks on American diplomats and military personnel, but we caught him in the act and terminated him."

Gen. Mark A. Milley, the chairman of the Joint Chiefs of Staff and Secretary of State Mike Pompeo echoed Trump's remarks, as did Robert O'Brien, the national security adviser. But Milley, Pompeo, O'Brien and other senior administration officials did not describe any new specific threats that were different from what American officials say Soleimani had been orchestrating for years.

Almost 24 hours after the attack on Soleimani, another airstrike killed five members of an Iranian-backed militia north of Baghdad, an Iraqi security official said, speaking on condition of anonymity because he was not authorized to talk to reporters.

Iranian-backed militias in Iraq known as the Popular Mobilization Forces confirmed the strike, saying it hit one of its medical convoys in Taji but didn't kill any of its top leaders.

The American military did not carry out the reported attack, according to a U.S. official who spoke on condition of anonymity.

In Baghdad, the State Department urged U.S. citizens to leave Iraq immediately, citing "heightened tensions." The U.S. Embassy, which had been under siege by pro-Iranian protesters chanting "Death to America" in recent days, suspended consular operations.

"U.S. citizens should not approach the Embassy," the State Department warned on Twitter.

At Fort Bragg, N.C., some 3,500 members of the 82nd Airborne, ordered to the Middle East this week, prepared to deploy to Kuwait.

Trump said that the killing early Friday of Soleimani, the commander of the Quds Force branch of Iran's Revolutionary Guard, was long overdue, though he insisted he did not want a larger fight with Iran.

"We took action last night to stop a war," the president said. "We did not take action to start a war." But moments later he warned Iran that the American military had "already fully identified" potential targets for further attacks "if Americans anywhere are threatened."

By early evening, as he came under growing criticism for what his critics called a reckless national security gamble, Trump said he wanted to contain the conflict.

"We do not seek war, we do not seek nation-building, we do not seek regime change," Trump told a gathering of his evangelical supporters in Miami, seeming to draw a contrast with the 2003 U.S.-led invasion of Iraq.

Hours earlier, Khamenei had warned Trump that there would be consequences for Soleimani's death.

"His departure to God does not end his path or his mission," Khamenei said in a statement, "but a forceful revenge awaits the criminals who have his blood and the blood of the other martyrs last night on their hands."

The White House approved the strike on Soleimani after a rocket attack last Friday on an Iraqi military base outside Kirkuk killed an American civilian contractor and injured other American and Iraqi personnel, according to a U.S. official who insisted on anonymity to discuss internal decisionmaking. The Joint Special Operations Command spent the next several days looking for an opportunity.

The option that was eventually approved depended on Soleimani's arrival on Thursday at Baghdad International Airport. If he was met by Iraqi officials, the U.S. official said, the strike would be called off. But the official said it turned out to be a "clean party," and the strike was approved.

It touched off an immediate debate in Washington, with Republicans hailing the action as a decisive blow against a longtime enemy with American blood on his hands and Democrats expressing concern that the president was risking a new war in the Middle East.

Democratic leaders complained that Trump acted without consulting or even telling Congress first. The president responded by retweeting a post comparing Sen. Chuck Schumer of New York, the Democratic leader, to the Iranians.

The post by Dinesh D'Souza, a conservative commentator who was pardoned by Trump for a campaign finance violation, scoffed at Schumer's complaint that he was not told in advance. "Neither were the Iranians, and for pretty much the same reason," D'Souza wrote in the tweet reposted by Trump.

Sen. Mitch McConnell of Kentucky, the Republican leader, said that a classified briefing was being arranged for all senators next week and that everyone should welcome the demise of Soleimani. "For too long, this evil man operated without constraint, and countless innocents have suffered for it," McConnell said on the floor. "Now his terrorist leadership has been ended."

Democrats said Trump's move could further involve the United States in Middle East conflict rather than pulling out as he has promised. "President Trump came into office saying he wanted to end America's wars in the Middle East, but today we are closer to war with Iran than ever before and the Administration's reckless policy over the last 3 years has brought us to the brink," Sen. Chris Van Hollen of Maryland wrote on Twitter.

Soleimani, the driving force behind Iranian-sponsored attacks and operations over two decades around the region including in Iraq, Syria, Yemen and Lebanon, was considered perhaps the second-most powerful figure in Iran, after Khamenei.

The decision to hit Soleimani complicates relations with Iraq's government, which has tried to balance itself between the United States and Iran.

A senior Iraqi official said Friday that there was a good chance the Iraqi parliament would vote to force U.S. troops to leave Iraq. Top Iraqi leaders earlier had wanted to accommodate the troop presence because of the persistent threat from ISIS and other regional security matters.

Dalia Dassa Kaye, an Iran expert at the RAND Corp., a research organization, said the killing of Soleimani was a "major escalation beyond proxy conflict to a direct conflict with Iran that is likely to be viewed in existential terms on Iran's side," especially in the wider context of Trump's continuing sanctions campaign to isolate Iran.

She added that likely costs included a rupture with the Iraqi government, which would weaken the fight against ISIS; a further alienation of U.S. allies who have been seeking de-escalation this year between Western nations and Iran; and growing challenges to containing Iran's nuclear ambitions.

"Just because the U.S. can take punitive actions doesn't mean it should," she said.

The Associated Press contributed to this report.