Senior judges at the international criminal court have authorised an investigation into alleged war crimes and crimes against humanity in Afghanistan, overturning an earlier rejection of the inquiry.

The ICC investigation will look at actions by US, Afghan and Taliban troops. It is possible, however, that allegations relating to UK troops could emerge in that process.

The US secretary of state, Mike Pompeo, on Thursday attacked the ruling by the ICC’s appeals chamber as “reckless” and said it would outline measures in the coming weeks to prevent US citizens being brought before the court.

“This is a truly breathtaking action by an unaccountable political institution masquerading as a legal body,” Pompeo told a news conference following the ruling.

“All the more reckless for this ruling to come just days after the United States signed a historic peace deal on Afghanistan, which is the best chance for peace in a generation.”

The ICC judges also approved that the scope of the investigation should include CIA black sites operated in Poland, Lithuania, and Romania, where detainees were taken.

The court had last year rejected the request to open an investigation and said any prosecution was unlikely to be successful because the expectation was that those targeted, including the US, Afghan authorities and the Taliban, would not cooperate.

Pompeo said at the time that Washington would revoke or deny visas to ICC staff seeking to investigate alleged war crimes and other abuses committed by US forces in Afghanistan or elsewhere. The court’s chief prosecutor, Fatou Bensouda, later confirmed that her US visa had been revoked.

But on Thursday the ICC’s appeals chamber said the lower court had misinterpreted some of the court’s rules, and it declared that the investigation should be allowed to go ahead.

Jamil Dakwar, director of the American Civil Liberties Union’s human rights programme, said: “This decision vindicates the rule of law and gives hope to the thousands of victims seeking accountability when domestic courts and authorities have failed them.

“While the road ahead is still long and bumpy, this decision is a significant milestone that bolsters the ICC’s independence in the face of the Trump administration’s bullying tactics.”

Reading out the decision, the chair of the appeals tribunal, Piotr Hofmański, said: “The prosecutor is authorised to commence investigation in relation to events dating back to 2003 as well as other alleged crimes [related to] Afghanistan.”

Bensouda has said there is information that members of the US military and intelligence agencies 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 early years of the conflict.

She has also said the Taliban and other insurgent groups have killed more than 17,000 Afghan civilians since 2009 and that Afghan security forces are suspected of torturing prisoners at government detention centres.

Preetha Gopalan, the deputy head of UK litigation at the human rights organisation Reprieve, said: “This decision is welcome news to everyone who believes that the perpetrators of war crimes should not enjoy impunity, no matter how powerful they are.

“This is the first time the US will be held to account for its actions, even though it tried to bully the ICC into shutting this investigation down. That the ICC did not bow to that pressure, and instead upheld victims’ right to accountability, gives us hope that no one is beyond the reach of justice.”

Ahmed Rabbani, a Pakistani taxi driver who was rendered to Afghanistan and tortured for 540 days by US personnel, was among the victims who supported the appeal. He has been held in Guantánamo since 2004 without charge or trial.

In a statement released through Reprieve, he said: “If the people who tortured me are investigated and prosecuted, I will be very happy. I would ask just one thing from them: an apology. If they are willing to compensate me with $1m for each year I have spent here, that will not be enough. I am still going through suffering and torture at present. But I would be happy with just three words: ‘We are sorry.’”

The decision last year to halt the investigation provoked dismay among international human rights organisations and allegations that the ICC had caved in to bullying by the Trump administration.

One line of investigation the ICC prosecutors were following involved the CIA’s alleged mistreatment of detainees.

Nikki Reisch, Counsel for the global justice clinic at NYU School of Law, said: “On behalf of our client, Mohammed al-Asad and his surviving family, we applaud the [ICC] Appeals Chamber for rejecting the repugnant logic of the US torture programme, which sought to place detainees in a legal black hole and deny them access to justice for the abuses they suffered. At a time when authoritarian tendencies are on the rise, the decision sends an important signal to all states that might does not make right, and that no one is above the law.”

Katherine Gallagher, of the Center for Constitutional Rights, said: “Today, the International Criminal Court breathed new life into the mantra that ‘no one is above the law’ and restored some hope that justice can be available – and applied -to all. For more than 15 years, like too many other victims of the US torture program, Sharqawi Al-Hajj and Guled Duran have suffered physically and mentally in unlawful US detention, while former senior US officials have enjoyed impunity.

“In authorising this critical and much-delayed investigation into crimes in and related to Afghanistan, the Court made clear that political interference in judicial proceedings will not be tolerated.”

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