After authorising the air strike that killed Iranian military commander Qassem Soleimani at Baghdad airport on Friday, US President Donald Trump said the US had expected an "imminent attack" by Iran, while Secretary of State Mike Pompeo said that Iran was planning "imminent action" that threatened US citizens.

In a Tweet on Sunday, Trump said: "They attacked us and we hit back", while on Friday, the US Department of Defense stated that the attack was launched "to stop a war, not start one".

They attacked us, & we hit back. If they attack again, which I would strongly advise them not to do, we will hit them harder than they have ever been hit before! https://t.co/qI5RfWsSCH — Donald J. Trump (@realDonaldTrump) January 5, 2020

According to experts on international law, the question of the legality of Trump's decision turns on whether the US was reacting to an imminent attack. To meet the requirements for self-defence under international law, the US had to have acted to avert an imminent attack.

More:

Kevin Jon Heller, professor of law at the University of Amsterdam, told Al Jazeera that Trump's reference to an imminent attack is "proof that the US still needs to offer some sort of legal justification for the attack. That's not as good as actually complying with international law, but it's better than nothing."

Calling for an independent investigation into the killing, Agnes Callamard, UN Special Rapporteur on extrajudicial, summary or arbitrary executions said: "Based on the information we have so far it is not possible to determine whether the strike was legitimate under the UN Charter governing the use of force."

Anticipatory self-defence

Article 51 of the Charter of the United Nations prohibits the use of force except under two circumstances: when the use of force was authorised by the UN Security Council and when a country acted in self-defence.

"Article 51 only permits self-defence in response to an attack that has already occurred or is underway. That said, state practice makes it clear that self-defence is also permissible in response to armed attacks that are imminent," said Heller.

The Red Cross defines self-defence as "the inherent right of a state to use of force in response to an armed attack".

Self-defence when an attack has not yet occurred, but is anticipated, is called anticipatory self-defence. Anticipatory self-defence should be distinguished from preventive self-defence, which seeks to halt a future threat, often in the absence of precise information.

As a doctrine, anticipatory self-defence is still in flux.

"There is some debate about the status of anticipatory self-defence," said Eliav Lieblich, associate professor of law at Tel Aviv University. "Preventive self-defence is quite clearly unlawful."

Heller said the legality of an attack depends on the immediacy of the threat that it aims to avert.

"If the plotting and planning is intended to launch an attack in the very near future, it is probably legitimate to act in self-defence. Beyond that, plotting and planning are not enough," he said.

Heller said that anticipatory self-defence should only be allowed when the so-called Caroline criteria are fulfilled.

Caroline criteria

The Caroline incident was a diplomatic incident between the US, Canada and the UK in 1837, involving the UK's attack on the US ship called Caroline. The Caroline criteria, which emerged from the resolution of the incident, hold that an attack has to be "imminent" in the sense that it has to be about to occur.

Self-defence must be necessary and must be "instant, overwhelming and leaving no choice and means, and leaves no moment for deliberation". This means that states may not use force to preemptively halt latent threats of force.

Callamard says: "There must be evidence of an imminent, certain, serious armed attack. The use of extraterritorial force should always be the exception."

"It is hard to square the US's objective of 'deterring future Iranian attack plans' with mainstream understandings of anticipatory self-defence," concludes Lieblich.

The danger of weakening the requirements for anticipatory self-defence is that "as you lower the threshhold for imminence, you enhance the risk of both mistake and abuse," he added.

"When you ease the requirement of imminence, use of force might become the rule, not an exception," he said.