Appeals judges at the International Criminal Court gave the green light on Thursday for prosecutors to open an investigation targeting the Taliban, Afghan forces and US military and intelligence personnel for war crimes and crimes against humanity.
"The prosecutor is authorised to commence an investigation into alleged crimes committed on the territory of Afghanistan since May 1, 2003," International Criminal Court judge Piotr Hofmanski said.
The global court upheld an appeal by prosecutors against a pretrial chamber's rejection in April last year of Prosecutor Fatou Bensouda's request to open a probe in Afghanistan. It is an investigation bitterly opposed by Washington.
The United States is not a member of the court and rejects its jurisdiction, although Afghanistan is a member.
In 2006, the ICC's prosecutors opened a preliminary probe into possible war crimes and crimes against humanity in the central Asian nation since 2003.
In 2017, chief prosecutor Fatou Bensouda asked judges to allow a full-blown probe, not only into Taliban and Afghan government personnel but also international forces, US troops and members of the Central Intelligence Agency.
Ms Bensouda said there was evidence to suggest US military and intelligence personnel “committed acts of torture, cruel treatment, outrages upon personal dignity, rape and sexual violence against conflict-related detainees in Afghanistan and other locations, principally in the 2003-2004 period”.
The Taliban and other insurgent groups have killed more than 17,000 Afghan civilians since 2009, including some 7,000 targeted killings, she said, adding that Afghan security forces are suspected of torturing prisoners at government detention centers.
But pre-trial judges said it "would not serve the interests of justice" and that the court should focus on cases with a better chance of success.
While US officials hailed the decision, human rights groups said it was a blow to thousands of the victims - and ICC prosecutors appealed.
Should Ms Bensouda lose, she is allowed to ask again for an investigation if "new facts or evidence regarding the same situation" emerge, according to the ICC's statute.
Ms Bensouda's move also unleashed a backlash from Washington, which in April last year revoked the Gambian-born chief prosecutor's visa as part of broader restrictions on ICC staff probing American or allied personnel.
Former national security adviser John Bolton warned in 2018 that the US would arrest ICC judges if the court pursued an Afghan probe.
The US has never joined the ICC and does not recognise its authority over American citizens, saying it poses a threat to national sovereignty.
Washington argues that it has its own procedures in place to deal with US troops who engage in misconduct.
Afghanistan also opposes the inquiry, saying the country itself had "responsibility to bring justice for our nation and for our people".
The ICC's ruling comes days after Taliban militants killed at least 20 Afghan soldiers and policemen in a string of overnight attacks, throwing the country's nascent peace process into grave doubt.
Under the terms of a recent US-Taliban agreement, foreign forces will quit Afghanistan within 14 months, subject to Taliban security guarantees and a pledge by the insurgents to hold talks with Kabul.
A US-led force invaded Afghanistan in 2001 following the 9/11 terror attacks in the US, targeting Al Qaeda in the sanctuaries provided by the Taliban government.
Fighting has continued ever since - last year more than 3,400 civilians were killed and almost 7,000 injured, according to data provided by UN agencies.