Judges at the International Criminal Court on Thursday ruled that an investigation into alleged war crimes committed in Afghanistan by the Taliban, Afghan military and U.S. forces may proceed.

The decision, which comes days after the United States agreed to pull its troops from the long-running conflict, overturns a lower court decision and opens the way for prosecutor Fatou Bensouda to launch a full investigation, despite U.S. government opposition.

"The Appeals chamber considers it appropriate to...authorise the investigation," said presiding Judge Piotr Hofmanski, noting that Bensouda's preliminary examination had found reasonable grounds to believe war crimes were committed in Afghanistan and that the court has jurisdiction.

Afghanistan is a member of the Hague-based court, though the United States is not and U.S. President Donald Trump's administration imposed travel restrictions and other sanctions against ICC employees a year ago.

A pretrial panel last year had rejected Bensouda's 2017 request to open an investigation, arguing that the odds of success were low, given the passage of time, a lack of cooperation from Kabul and Washington, and because it would not "serve the interests of justice."

But Hofmanski said Bensouda should proceed and not limit her investigation to preliminary findings, as that would "erroneously inhibit the prosecution's truth-seeking function."

Bensouda believes there are grounds to open an investigation into abuses committed between 2003 and 2014, including alleged mass killings of civilians by the Taliban, as well as the alleged torture of prisoners by Afghan authorities and to a lesser extent by U.S. forces and the CIA.

U.S. forces and other foreign troops entered Afghanistan in 2001 after the Sept. 11 al Qaeda attacks on the United States and overthrew the Taliban government, which had been protecting al Qaeda leader Osama bin Laden.

In what has become the United States' longest war, about 13,000 U.S. troops remain in Afghanistan.

The United States and the Taliban signed an agreement on Saturday to withdraw thousands of U.S. troops still in the country, but Washington carried out an air strike on Taliban fighters on Wednesday.

The ICC, which began operations in The Hague in 2002, is a court of last resort for war crimes, genocide and crimes against humanity when committed by nationals of a signatory state, or if they took place on the territory of one of its member states.