WASHINGTON—The House of Representatives passed legislation to limit President Donald Trump’s ability to go to war against Iran without congressional approval Thursday, but it still needs approval by the Republican-controlled Senate.

The measure, approved 224-194 on a largely party line vote, would prohibit using the military to engage in hostile actions in or against Iran, except with congressional approval or in case of an imminent attack against the US.It is a reaction to Trump’s decision to use a drone strike last Friday to kill Iranian Gen. Quasem Soleimani.

During a three-hour debate in the House chamber, Republicans and Democrats sparred over the killing of the Iranian general, with the GOP congressmen emphasizing his involvement in terrorist activities.

“General Soleimani was the head of one of the most advanced terrorist communities in the world,” said Rep. Den Crenshaw, R-Texas.

Rep. Scott Perry, R-Pa., argued that the bill was “appeasing Iran.”

However, the resolution acknowledges the Iranian government as a “leading state sponsor of terrorism” and also calls Soleimani “the lead architect of much of Iran’s destabilizing activities throughout the world.”

The Trump administration argued that Congress was not warned about the attack on Soleimani due to its confidential nature. Speaker of the House Nancy Pelosi responded by saying Congress can be told confidential information without exposing it.

“We deserve respect from the administration,” said Pelosi.

Florida Rep. Matt Gaetz was one of three Republicans to vote in favor of the document. He emphasized Congress’ role in declaring war and urged his colleagues to be at the forefront of decisions on war and peace.

“I think it’s ludicrous to suggest that we are impairing the troops from doing their job by not doing our job articulated in the Constitution to speak to these matters of war and peace,” said Gaetz. “I support the president. Killing Soleimani was the right decision and engaging in another forever war in the Middle East would be the wrong decision and that is why I’m voting for this resolution.”