As a private citizen, Mr. Trump repeatedly accused Mr. Obama of preparing to go to war with Iran to bolster his re-election chances in 2012. As president, Mr. Trump has questioned his own intelligence agencies and peddled repeated falsehoods, a record that could undermine the administration’s credibility on the highly delicate subject.

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

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

John R. Bolton, the hawkish former national security adviser who left his job in September after clashes with Mr. Trump on Iran and other issues, offered “congratulations” on the killing of General Suleimani and said it was a “decisive blow” against the Quds Force. Posting on Twitter, he added that he hoped that this was the “first step to regime change in Tehran.”

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

Democrats said Mr. Trump’s move could further involve the United States in Middle East conflict rather than pull 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,” Senator Chris Van Hollen of Maryland tweeted.

General Suleimani, 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 Ayatollah Khamenei.