BAGHDAD — Lawmakers in Iraq voted on Sunday to require the government to end the presence of American troops in the country after the United States ordered the killing of the Iranian leader of the elite Quds Force, Maj. Gen. Qassim Suleimani, on Iraqi soil.
The decision to heed the demands of angry Shiite factions and politicians came as hundreds of thousands of mourners poured into the streets of Iran to pay their respects to General Suleimani, the most powerful figure in the country after the supreme leader, Ayatollah Ali Khamenei.
The vote is not final until Prime Minister Adel Abdul Mahdi of Iraq signs the bill. But since he drafted the language and submitted the bill to Parliament, there was little doubt he would sign it.
Although the vote was 170-0 in Parliament, many of its 328 members, primarily Kurds and Sunnis, did not attend the session and did not vote, showing the division in Parliament on the demands to oust American troops. While groups that grew out of Shiite militia organizations have pushed hard for the expulsion, Sunni Muslim factions and the Kurds wanted the United States to stay.
The legislation threads a fine needle: While using strong language demanding that the government “end any foreign presence on Iraqi soil and prevent the use of Iraqi airspace, soil and water for any reason” by foreign forces, it gives no timetable for doing so.
It would end the mission approved in 2014 that gave the United States the explicit task of helping the Iraqi forces to fight the Islamic State. That agreement gave the Americans substantial latitude to launch attacks and use Iraqi airspace. A pullout of the estimated 5,200 American troops could cripple the fight against the Islamic State, or ISIS, and could allow its resurgence.
But the measure would leave in place the Strategic Framework Agreement, which allows an American troop presence in Iraq in some form.
On Sunday, Mr. Abdul Mahdi urged lawmakers to act after President Trump ordered a drone strike that killed General Suleimani in the Baghdad airport on Friday.
The body of General Suleimani was brought back early Sunday from Iraq, where he was killed on Friday near the Baghdad airport. Among the others killed in the attack was Abu Mahdi al-Muhandis, the deputy head of the Iraqi Popular Mobilization Forces, which includes at least half a dozen pro-Iranian militias.
The general’s killing unleashed calls for vengeance in both Iraq and Iran, and reinforced a general solidarity among hard-liners and moderates in Iran against the United States. After the vote in Iraq calling on the government to expel American troops, Iranian officials reacted with congratulatory messages.
Hesameddin Ashena, a top adviser to President Hassan Rouhani, wrote on Twitter, “Expanding friendship with our neighbors and domestic unity are the best gifts for protecting our national security.”
In Iraq, the attack was seen as a violation of the nation’s sovereignty. On Sunday, Iraq’s Foreign Ministry said it had summoned the American ambassador in Baghdad. In Iran, it was viewed as tantamount to an act of war. Hossein Dehghan, a military adviser to Mr. Khamenei, told CNN that Iran’s response would include an attack on “U.S. military targets.”
As the Middle East braced for Iranian retaliation, which analysts said was all but inevitable and American officials said they expected within weeks, Tehran and Washington ratcheted up the rhetoric.
Members of Iran’s Parliament chanted, “Death to America!” en masse in the chamber on Sunday in protest over General Suleimani’s killing, television footage showed.
The chants came as Mr. Trump fired off a series of Twitter ripostes to the growing anger, including that the United States had pinpointed 52 targets in Iran, including cultural sites, if there were any retaliation for the killing. He said the sites represented the 52 Americans hostages “taken by Iran many years ago” at the United States Embassy.
That led Iran’s foreign minister, Mohammad Javad Zarif, to respond on Twitter that “targeting cultural sites is a war crime.” He said that the “end of U.S. malign presence in West Asia has begun.”
Iran summoned the Swiss envoy representing American interests in Tehran on Sunday to protest Mr. Trump’s threat that Washington would target Iranian sites. And Mr. Trump’s tweet became a rallying cry among Iranians sharing it widely on social media and phone applications with the message, “Attend the funeral for our cultural heritage.”
Iran’s information and telecommunications minister, Mohammad Javad Azari-Jahromi, tweeted on Sunday that Mr. Trump was “a terrorist in a suit.”
“Like ISIS, Like Hitler, Like Genghis! They all hate cultures. Trump is a terrorist in a suit. He will learn history very soon that NOBODY can defeat ‘the Great Iranian Nation & Culture,’” Mr. Jahromi wrote.
The drone attack left America’s European allies scrambling to address the safety of their troops in the Middle East and complaining that they had been given no warning about the strike. But European leaders also called for de-escalation between Iran and the United States.
The European Union’s foreign policy chief, Josep Borrell, invited Mr. Zarif to Brussels for talks. Mr. Borrell said in a statement that he had spoken to Iran’s foreign minister, urging “Iran to exercise restraint and carefully consider any reaction to avoid further escalation, which harms the entire region and its people.”
Germany’s foreign minister, Heiko Maas, said he would seek direct talks with Iran after the American killing of General Suleimani. Europe wants to continue the fight against the Islamic State, Mr. Maas said, and Germany is anxious about the safety of its troops training Iraqi fighters against the Islamic State militants.
The European outreach came as the United States and its NATO allies suspended training Iraqi forces for security reasons after the killing of General Suleimani.
Germany’s defense minister, Annegret Kramp-Karrenbauer, said in a statement: “Iraq cannot be allowed to sink into chaos, and certainly not under the control of extremists. Therefore, it is important not to let up now in the fight against Islamic State.”
In general, the Europeans did not specifically criticize Mr. Trump for his decision, and generally share the American view that Iran has been a destabilizing force in the Middle East and a supporter of terrorism. At the same time, no European government praised the killing of General Suleimani, emphasizing instead the increased risks to their citizens, troops and interests.
Prime Minister Boris Johnson of Britain was reported to be angry with Mr. Trump for not informing him or other allies with troops in Iraq about the decision to kill General Suleimani. While carried out by the Americans, the killing is thought to have put all European citizens and troops in Iraq and the wider region at heightened risk.
Mr. Johnson, who was said to be returning early from a vacation in the Caribbean, is expected to discuss the issues with Chancellor Angela Merkel of Germany, President Emmanuel Macron of France and Mr. Trump in the next few days, a Downing Street spokeswoman said.
Secretary of State Mike Pompeo complained that the response by European allies had not been “helpful.” He told Fox News in an interview: “Frankly, the Europeans haven’t been as helpful as I wish that they could be. The Brits, the French, the Germans all need to understand that what we did, what the Americans did, saved lives in Europe as well.”
Dominic Raab, Britain’s foreign minister, who is scheduled to travel to Washington this week to meet Mr. Pompeo, said any country had a right to defend itself.
Asked in an interview with the BBC whether the killing was legal, Mr. Raab said, “There is a right of self-defense.” He said he did not agree that the killing was an act of war, and described General Suleimani to Sky News, another British broadcaster, as a “regional menace.”
But Mr. Raab also said that he had spoken to Iraq’s prime minister and president to urge a de-escalation of tensions in the region, and that he planned to speak to Iran’s foreign minister.
In particular, the Europeans are trying to persuade Iran to keep to the 2015 nuclear deal, known as the Joint Comprehensive Plan of Action, which Mr. Trump pulled the United States out of in May 2018, reimposing harsh economic sanctions on Tehran. Since then, Iran has slowly abandoned its adherence to parts of the deal.
On Sunday, a Foreign Ministry spokesman, Abbas Mousavi, said Iran was ready to decide its next step to further roll back its commitments to the deal. The National Security Council would hold an emergency meeting Sunday evening to make a final decision about the nuclear deal, he said.
“There will be an important meeting tonight about decreasing our commitments in J.C.P.O.A., taking the fifth step and making a final decision,” Mr. Mousavi said, according to the state news agency IRNA, using the acronym for the nuclear deal.
The Europeans are also working to keep the Strait of Hormuz open to shipping. About one-third of the world’s oil tankers use the waterway, which Iran has intermittently threatened to close. Last July, Iranian forces boarded and seized a British-flagged tanker in the Strait, trying to pressure the world to allow its oil exports despite American sanctions.
On Saturday, Britain’s defense minister, Ben Wallace, said he had ordered the country’s Navy to accompany all British-flagged ships through the Strait of Hormuz.
France has also stepped up diplomatic initiatives to ease tensions. Mr. Macron spoke to President Barham Salih of Iraq and the de facto ruler of the United Arab Emirates, Crown Prince Mohammed bin Zayed of Abu Dhabi.
Even as the Europeans scrambled on several fronts, the coffin of General Suleimani arrived in Ahvaz, in southwestern Iran, which has a significant ethnic Arab population. The region has not always supported the government, and many citizens joined the recent protests against the regime. But they are united in their support for General Suleimani, a figure they viewed as larger than life.
Amir, a 35-year-old businessman and resident of Ahvaz who asked that his last name not be used for security reasons, attended the funeral and said that although he did not support Iran’s government, General Suleimani’s killing had touched a nationalist nerve.
“The attack really wounded and insulted the national pride of Iranians,” he said. “I went to show my solidarity and to say no to war with Iran.”
After Ahvaz, the general’s body will be flown to Mashhad, a major religious center for Shiites in northeastern Iran. It will then be taken to Tehran, where a highway was named after General Suleimani on Sunday. A state funeral will be held on Monday. He will be buried in his hometown, Kerman, on Tuesday.
The body of Mr. al-Muhandis is with the general’s, but it is not clear whether he will also be buried in Iran or if his body will return to Najaf, Iraq, where almost all Iraqi Shiites are buried. Mr. al-Muhandis married an Iranian and became an Iranian citizen.
Also Sunday, Kataib Hezbollah, the armed group arguably closest to Iran, warned Iraqi troops on bases that also house United States troops that they should stay at least 3,000 feet from American counterparts starting on Sunday evening, and not allow themselves to be used as human shields.
Alissa J. Rubin reported from Baghdad, Steven Erlanger from Brussels, and Farnaz Fassihi from New York.