NEW YORK (Reuters) - The Trump administration on Friday justified its killing of a top Iranian general as an act of self-defense, trying to deflect accusations that it violated international law and concerns raised by legal experts and a senior U.N. rights investigator.

Qassem Soleimani, the 62-year-old commander of Iran’s elite Quds Force, was killed in the U.S. air strike in Baghdad overnight. The attack, ordered by President Donald Trump, sent tensions between the United States and Iran soaring, with Iranian officials promising revenge.

As Republican and Democratic lawmakers sparred over the wisdom of the attack, some legal experts questioned whether Trump had the legal authority to target Soleimani on Iraqi soil without the permission of Iraq’s government, and whether it was legal under international and U.S. law.

Iraq’s prime minister said Washington had with the attack violated a deal for keeping U.S. troops in his country, and several Iraqi political factions united in a call for American troops to be expelled.

The U.N. Charter generally prohibits the use of force against other states but there is an exception if a state gives consent to the use of force on its territory. Legal experts said the absence of consent from Iraq makes it difficult for the United States to justify the killing.

Yale Law School professor Oona Hathaway, an international law expert, said on Twitter that the available facts “do not seem to support” the assertion that the strike was an act of self-defense, and concluded it was “legally tenuous under both domestic and international law.”

The Pentagon said targeting Soleimani was aimed at deterring “future Iranian attack plans,” while Trump said the Iranian general was targeted because he was planning “imminent and sinister” attacks on U.S. diplomats and military personnel.

Robert Chesney, a national security law expert at the University of Texas at Austin School of Law, said the administration’s best argument on the U.N. Charter issue is self defense. “If you accept that this guy was planning operations to kill Americans, that provides the authority to respond,” he said.

Scott Anderson, a former legal adviser to the U.S. Embassy in Baghdad under Trump’s predecessor, Barack Obama, said Trump’s justification so far under international law is questionable, but he could try to argue that the Iraqi government was either unwilling or unable to deal with the threat posed by Soleimani, giving the United States the right to act without Iraq’s consent.

Iranian guards hold a picture of the late Iranian Major-General Qassem Soleimani, during a protest against the killing of Soleimani, head of the elite Quds Force, and Iraqi militia commander Abu Mahdi al-Muhandis, who were killed in an air strike at Baghdad airport, in front of United Nation office in Tehran, Iran January 3, 2020. WANA (West Asia News Agency)/Nazanin Tabatabaee via REUTERS

Article 51 of the U.N. Charter covers an individual or collective right to self-defense against armed attack. The United States used the article to justify taking action in Syria against Islamic State militants in 2014.

U.S. forces in Iraq had been fighting Islamic State, and about 5,000 troops remain, most of them in an advisory capacity.

A strategic framework agreement signed in 2008 between Washington and Baghdad called for close defense cooperation to deter threats to Iraqi “sovereignty, security and territorial integrity,” but prohibited the United States from using Iraq as a launching point for attacks on other countries.

Under historic norms of international law, a country can defend itself preemptively if it acts out of necessity and responds proportionally to the threat.

Agnes Callamard, the U.N. special rapporteur on extra-judicial executions, questioned whether the attack met this threshold.

The targeting of Soleimani “appears far more retaliatory for past acts than anticipatory for imminent self-defense,” she said. “Lawful justifications for such killings are very narrowly defined and it is hard to imagine how any of these can apply to these killings.”

Democratic lawmakers called on Trump to provide details about the imminent threat that he said Soleimani represented.

“I believe there was a threat, but the question of how imminent is still one I want answered,” Senator Mark Warner, the Democratic vice-chair of the Senate Intelligence Committee, told Reuters.

Other critics raised questions about Trump’s authority to kill Soleimani under U.S. law, and whether he should have acted without first notifying Congress.

Legal experts noted that recent U.S. presidents from both parties have taken an expansive view of their unilateral ability to preemptively engage in force, including through targeted killings, a view bolstered by executive branch lawyers in successive administrations.

In the case of Soleimani, the administration’s self-defense arguments may hinge on disclosing specific knowledge of his imminent plans to attack Americans.

Self-defense could allow the administration to act without having to first notify Congress or act under a prior congressional authorization for the use of military force, Chesney said.

Democratic lawmakers did not defend Soleimani, who U.S. officials have said is responsible for the deaths of hundreds of Americans, but they called on Trump to consult with Congress going forward.

“This administration, like all others, has the right to act in self-defense,” said Rep. Elissa Slotkin, a former Central Intelligence Agency analyst who worked in Iraq focusing on Iranian-backed militias. “But the administration must come to Congress immediately and consult.”