As visiting day begins at Sarposa prison, on the western edge of Kandahar city, Afghanistan, a throng of burqa-clad women and school-age children gathers outside and waits to pass through the facility’s outer gate. Every spare hand holds either the small fist of a young child or a cloth sack of food and supplies for the men inside. A half-dozen smiling Afghan guards watch the steady flow, preparing to search for contraband. American advisers observe from a distance, waiting to see whether the guards will follow their basic lessons on how to run a safe and secure prison.

More pressing questions hang unspoken in the dry air: When will the training be done? When can U.S. officials hand Afghans the prison keys — figuratively and literally — and walk away without serious security and humanitarian concerns?

These concerns loom over nearly everything the United States does in Afghanistan, particularly under pressure from the deadline for security transition by the end of 2014. But prisons stand at the intersection of multiple security and non-security efforts, including those that address detention and corrections operations, the rule of law and the justice system, corruption and the reintegration of former Taliban fighters. Setbacks in reforming the Afghan corrections system are frustrating for U.S. officials. They are ready to leave but unable to go.

Despite the combined work of U.S. and NATO officials, detention operations in Afghanistan remain among the most problematic in the world. Since 2001, the number of prisoners held in the country’s 34 provincial prisons and 200-plus district detention centers has grown from approximately 600 to nearly 21,000. Overcrowding has strained a decaying infrastructure, while personnel shortages, inadequate guard training and corruption have further undermined operations. Add poor government oversight and the persistent influence of militant extremists throughout the country, and Afghan prisons have become a necessary evil — an essential component of security efforts that often causes as many problems as it solves.

Most of these problems persist despite many years and many dollars spent on reform efforts. Security is still a major concern. In April, more than 480 Taliban prisoners tunneled out of Sarposa in what some corrections experts call the most amazing breakout since the Great Escape of World War II. Corruption continues to be rampant. Detainees bribe poorly paid guards, get cellphones to call criminal associates and allow radicals to exert widespread influence throughout the prison system. As a result, insurgents can use prisons as bases from which to plan lethal operations against U.S., coalition and Afghan forces.

Concerns about prisoner abuse are also still present. Just a few weeks ago, the United Nations reported systematic torture at some Afghan detention centers, prompting U.S. and NATO officials to stop transferring prisoners to Afghan custody in several provinces.

Part of the problem may be how U.S. and coalition officials have approached prison reformation in Afghanistan — by introducing systems and methods that are effective in Western prisons and training Afghans to look at their corrections system as we do ours. But American corrections experts say cultural norms and the situation on the ground mean that Afghan prisons often function very differently than those in the United States. They describe guards’ relationships with inmates as nonconfrontational and less authoritarian, and say that Afghan detention centers sometimes serve more like halfway houses than anything else. Some NATO allies concede that while newly constructed prisons improve security by increasing the likelihood that prisoners will be locked in their cells, they also challenge Afghans to forgo elements that resonate culturally, such as having inmates share a collective life in the prison courtyard. As a result, even our best efforts at reforming their correction system inevitably leave gaps.

This is a picture of failure on many levels for the Afghans. It suggests problems within Afghanistan’s Central Prison Directorate, which supervises the corrections system. It highlights rule-of-law deficiencies throughout the country, including a weak formal justice system and ineffective counterterrorism laws that render courts and prosecutors powerless. As a result, prisons burst at the seams with petty criminals while high-threat individuals often are released. It underscores how corruption undermines everything we do there. Even as the United States pours billions into Afghanistan, the budget for prisons remains meager, with guards underpaid, undereducated and prone to accepting bribes.

While doing research at Sarposa this summer, I was struck by the eerie silence in the sea-green-colored hall of the political block. Prisoners and family visitors mingled noisily in the main corridor of the criminal wing, but the political wing — home to captured Taliban members and those charged with terrorism-related crimes in Kandahar province — was mostly empty. Empty except for two medium-size cells that housed almost a dozen former prison guards, all of whom who were under investigation for helping the Taliban inmates escape this past spring.

That escape was the second major break from Sarposa in less than three years. In 2008, about 1,000 prisoners escaped during a massive attack by Taliban militants. Since then, American and Canadian advisers have worked tirelessly to improve the prison — including refurbishing its cellblocks, rebuilding its watchtowers, and providing its guards new equipment and training — but the problems continue. They’re inside the system. The mass exodus of almost every inmate from the political wing could not have occurred without the knowledge — and probably the help — of Afghans inside and outside the prison.

Indeed, while militants in the neighborhood southwest of Sarposa spent an estimated five months digging the escape tunnel, no community member reported the activity to U.S. or NATO officials or otherwise helped prevent the jailbreak. Threats of retaliation from insurgents probably silenced many residents, but what about the security officers and local political leaders who have committed to supporting our efforts? Even more concerning are suspicions that officials at the very top of the regime — including President Hamid Karzai — must have had foreknowledge of this brazen, well-coordinated escape, in which hundreds of Taliban members quietly snuck out over a four-hour period through a tunnel that was wired for lighting and ventilation.

Karzai’s regime lamented the breakout, calling it a “disaster.” Little has changed, however. And the United States and the international community continue to provide training and to fund prison reform programs — because, for now, our soldiers keep capturing bad guys, and we need someplace to put them. But vulnerabilities in the prison system represent a greater danger to Afghanistan’s long-term security and well-being than to ours. Ultimately, Afghans need to take responsibility for its failures and successes.

After spending 10 years and billions of taxpayer dollars in Afghanistan, the United States can and should demand more from Afghans. While recognizing the potential shortcomings of Western-focused reform programs, the United States should require greater Afghan accountability in the initiatives we provide and fund, and more Afghan responsibility for ensuring that a transition will be possible, in detention efforts and beyond. Karzai must set the example on this. Until he decides that his role as Afghanistan’s leader involves, first and foremost, holding his government and his people accountable — including punishing those who are complicit in corruption, mistreatment or other problems central to the flawed corrections system — failure will remain the status quo.

Marisa L. Porges is a former counterterrorism policy adviser with the Defense and Treasury departments. She is a fellow at the International Center for the Study of Radicalization, a London-based think tank.

Read more from Outlook, friend us on Facebook, and follow us on Twitter.