The Afghan government’s plan to release 88 high-profile detainees without trial “would have an unbelievably negative impact” on U.S.-Afghan relations, according to two of Congress’s biggest advocates for an enduring American presence here.

During a visit to Kabul on Thursday, Republican Sens. John McCain (Ariz.) and Lindsey O. Graham (S.C.) said that although their differences with Afghan President Hamid Karzai were narrowing on many issues, the prisoner release threatens to undermine bilateral ties at a critical moment — as the deadline for a long-term security agreement looms.

In March, the United States transferred control of the Parwan prison next to Bagram air base — with its roughly 3,000 detainees — to the Afghan government. Since then, Graham said, the Afghans have released 560 detainees without trial, and “some of those have gone back to the fight.”

The Afghan government is now considering releasing 88 detainees who are of particular concern to the United States. Collectively, Graham said, they killed 60 members of the U.S.-led International Security Assistance Force (ISAF).

When the United States transferred control of the Parwan Detention Facility, it mandated that detainees with evidence against them be tried in Afghan courts. U.S. officials say that agreement is being violated, because the cases are being decided only by a review board, which lacks the judicial authority to make such rulings.

“Release of these individuals by the Afghan Review Board undermines Afghan rule of law, because the Afghan people do not get their day in court,” said Col. David Lapan, a spokesman for ISAF. “Based on the evidence and the risk these individuals pose to the peace and security of the Afghan people, and in accordance with Afghan law, their cases should be addressed by the formal Afghan justice system.”

U.S. officials said last year that they understood the risks involved in handing over control of the prison — the transfer was considered a key part of the transition process — as the United States withdraws its troops and shutters bases. But although they assumed that a number of prisoners would be released, they expected the Afghan government to at least follow due process, adjudicating cases through Afghan courts, which the United States has spent a decade trying to bolster.

The prisoner release, Graham said, would lead to a “backlash in the U.S. Congress,” which would need to appropriate funds for any long-term American commitment in Afghanistan.

“Unless we resolve these differences, the United States of America has no choice but to not continue with its commitment,” McCain said.

The possibility that the 88 prisoners will be released without trial is particularly frustrating to U.S. officials because they had sent evidence to the review board that might have yielded convictions. That evidence, apparently, is being ignored.

Asked about the issue, Afghan officials said without elaborating that the U.S. military, too, was keeping Afghan detainees without trial at Parwan.

“It is a clear violation of all agreements and absolutely illegal,” said Aimal Faizi, a spokesman for Karzai. “They want us to close our eyes on it, but it is unacceptable for us.”

When control of the prison was transferred last year, U.S. officials deemed 40 detainees as “enduring security threats” whose release could destabilize the country. The Afghan government agreed not to release them until the end of 2014.

Although none of the 88 detainees slated for release were labeled “enduring security threats,” Graham said he worries that if Afghan leaders are willing to carry out one unlawful prisoner release, they could do so again when the stakes are higher.

“If this agreement is dishonored, how can you expect future agreements to be honored?” he asked.

McCain and Graham said there is an urgent need to resolve the prisoner dispute, as well as other points of contention with Karzai, so that the bilateral security agreement could be signed. They did not mention a firm deadline for signing the accord, but they noted that Congress needs to approve a budget — including expenditures in Afghanistan — by Jan. 15 and that President Obama’s State of the Union speech is scheduled for Jan. 21.

“What is [Obama] going to tell the American people about Afghanistan if there is no bilateral agreement signed?” Graham said.