PARIS — The International Criminal Court abandoned a possible Afghanistan war-crimes investigation on Friday, saying the United States and others in the conflict would not cooperate.

The court’s chief prosecutor had long sought permission to open a formal inquiry into civilian killings, torture and other abuses in the Afghanistan war, including possible crimes by American forces. But a panel of the court’s judges decided that the difficulties of obtaining evidence and witness testimony outweighed the benefits of a prosecution, with a low prospect of any convictions.

The decision was welcomed by the Trump administration and came just weeks after Secretary of State Mike Pompeo said Washington would deny visas to the court’s staff and judges involved in prosecuting or ruling on war crimes involving Americans. Last week the State Department confirmed that the United States visa of the court’s chief prosecutor, Fatou Bensouda, had been revoked.

[Read: The I.C.C. has allowed Afghanistan war crimes inquiry to proceed.]

But the decision by the judges, which took nearly 18 months to reach, troubled lawyers and stunned human rights activists, who said the court had capitulated to what they called Trump administration intimidation and pressure that had weakened the court’s credibility.