Former Commander of the International Security Assistance Force Gen. David Petraeus, center, who is now director of the CIA, tours the grounds of the U.S.-run Parwan detention facility near Bagram north of Kabul, Afghanistan on Sept. 27, 2010. (David Guttenfelder/AP)

The United States has for several years been secretly releasing high-level detainees from a military prison in Afghanistan as part of negotiations with insurgent groups, a bold effort to quell violence but one that U.S. officials acknowledge poses substantial risks.

As the United States has unsuccessfully pursued a peace deal with the Taliban, the “strategic release” program has quietly served as a live diplomatic channel, allowing American officials to use prisoners as bargaining chips in restive provinces where military power has reached its limits.

But the releases are an inherent gamble: The freed detainees are often notorious fighters who would not be released under the traditional legal system for military prisoners in Afghanistan. They must promise to give up violence — and U.S. officials warn them that if they are caught attacking American troops, they will be detained once again.

There are no absolute guarantees, however, and officials would not say whether those who have been released under the program have later returned to attack U.S. and Afghan forces once again.

“Everyone agrees they are guilty of what they have done and should remain in detention. Everyone agrees that these are bad guys. But the benefits outweigh the risks,” said one U.S. official who, like others, discussed the issue on the condition of anonymity because of the sensitivity of the program.

The releases have come amid broader efforts to end the decade-long war through negotiation, which is a central feature of the Obama administration’s strategy for leaving Afghanistan. Those efforts, however, have yielded little to no progress in recent years. In part, they have been stymied by the unwillingness of the United States to release five prisoners from Guantanamo Bay — a gesture that insurgent leaders have said they see as a precondition for peace talks.

Unlike at Guantanamo, releasing prisoners from the Parwan detention center, the only American military prison in Afghanistan, does not require congressional approval and can be done clandestinely. And although official negotiations with top insurgent leaders are seen by many as an endgame for the war, which has claimed nearly 2,000 U.S. lives, the strategic release program has a less ambitious goal: to quell violence in concentrated areas where NATO is unable to ensure security, particularly as troops continue to withdraw. The releases are intended to produce tactical gains but are not considered part of a grand bargain with the Taliban.

U.S. officials would not say how many detainees have been released under the program, though they said such cases are relatively rare. The program has existed for several years, but officials would not confirm exactly when it was established.

The process begins with conversations between U.S. military officials and insurgent commanders or local elders, who promise that violence will decrease in their district — or that militants will cease fighting altogether — if certain insurgents are released from Parwan. The value of the tradeoff and the sincerity of the guarantee are then weighed by senior military officials in Kabul, officials said.

“The Afghans have come to us with information that might strengthen the reconciliation process,” U.S. Ambassador Ryan C. Crocker said. “Many times we do act on it.”

The insurgents released through the secret program are the only detainees at Parwan who are able to circumvent the prison’s judicial review board. Their release is instead approved directly by the United States’ top commander and top military lawyer in Afghanistan, U.S. officials said. One official described the process as being “outside of our normal protocol.”

As opposed to the formal NATO-sponsored reintegration program, which forces militants to sever ties with the insurgency, the strategic release program does not require detainees to formally disavow their relationship to the Taliban, Hezb-i-Islami or other insurgent groups. In some cases, detainees are expected to maintain those connections and use them to further peace-building efforts between the Americans and the insurgents.

“We look at detainees who have influence over other insurgents — individuals whose release could have a calming effect in an entire area,” one U.S. official said. “In those cases, the benefits of release could outweigh the reasons for keeping him detained.”

When the insurgency appears to be gathering steam in certain provinces, for instance, prisoners have been released to alleviate mounting tension.

Some Afghans say they worry that although the program might be effective in quelling violence, it marginalizes their role in the country’s reconciliation process. Afghans often provide intelligence that leads to strategic releases, but Americans ultimately make the decision to release detainees. And in some cases, insurgent commanders attempt to broker deals directly with American officials, excluding the Afghan security forces from the process.

“We tried to get the [insurgent] commanders to work with the Afghan National Army, but they weren’t interested,” said a U.S. commander in eastern Afghanistan who worked on a strategic release this year.

One recent case involved a commander with Hezb-i-Islami who was described by Lt. Col. John Woodward, formerly the top U.S. commander in northern Wardak province, as “operationally and tactically a significant player.”

In the Nerkh Valley, a violent swath of Wardak, Woodward had decided that “given our resources, there’s no way we could fight both the Taliban and ­Hezb-i-Islami.”

Although the Taliban and Hezb-i-Islami are both insurgent groups, they have different leadership structures and operate independently.

Through local politicians and elders, the American officer began negotiating with Hezb-i-­Islami commanders, who for years had been firing at American troops. Those talks progressed, and weeks later, the insurgent group was providing useful intelligence on the whereabouts of Taliban fighters. Before long, the U.S. troops and Hezb-i-Islami fighters were conducting joint operations, traveling in the same vehicles and sleeping on the same bases, Woodward said.

But amid that progress, the insurgent commanders came to Woodward with a request. They wanted a relative — the man considered a “significant player” — to be released from Parwan. Woodward began contacting his superiors about the strategic release program.

Researcher Julie Tate in Washington contributed to this report.