With the U.S. combat role in Afghanistan coming to an end, and the Bilateral Security Agreement now under review, officials are under pressure to do something many observers may believe was already done: end U.S. detentions at the Detention Facility in Parwan (DFIP), or Bagram. Though the U.S. government recently handed over 3,000 Afghan detainees, more than 60 third country nationals, or TCNs, remain in U.S. custody. U.S. officials have stated that resolving their cases is their goal, and that December 2014 is the deadline. But right now the United States will likely fail to do so, possibly leaving detainees in indefinite limbo, and raising serious legal and political concerns for the U.S. presence in Afghanistan post-2014.

Over the years, many have criticized U.S. detentions as inconsistent with applicable international human rights law and for failing to provide the requisite level of due process—all of which will take on new urgency as the United States brings an end to its combat mission in 2014. So too will concern over the legality of U.S. detentions under Afghan law, which has thus far received too little attention. Such differences reflect deeper disagreement over post-2014 U.S. engagement.

Just last week, U.S. officials criticized the Afghan government’s recommendation to release many transferred detainees because of lack of evidence to prosecute or continue their detention under Afghan law. As outlined in a report last year by Open Society Foundations, an Afghan internment regime modeled on the U.S. system was initially proposed as part of the DFIP transfer, but appeared to violate several Afghan constitutional guarantees. The dispute over the legality of the detention regime under Afghan law eventually led to a suspension of the Bagram handover and the Afghan government deciding against formally adopting such a regime.

In consenting to U.S. detentions at the DFIP, the Afghan government has already been in violation of its own legal obligations under Afghan domestic law and constitution as well international human rights law. With the United States bringing an end to its combat operations, and an Afghan presidential election on the horizon, Afghan leaders will likely view ongoing U.S. detentions as legally untenable and a political liability, which could jeopardize U.S.-Afghan relations at a critical time.

This is a problem that is entirely avoidable if concerted action is taken now and over the next year to resolve TCN cases. The majority of the approximately 60 TCNs currently held in limbo at Bagram are Pakistani.  A recent report by the NGO Justice Project Pakistan (JPP) reveals how the U.S. and Pakistani have failed to put in place the policies, protocols, and political capital necessary to resolve these cases by the end of combat operations. As JPP’s report documents, even after the handover of the DFIP to the Afghans in March 2013, progress on TCNs has been excruciatingly slow. Six Pakistani detainees have been slated for repatriation to Pakistan for almost a year, yet remain in detention, a clear violation of their rights under IHL and IHRL. Negotiation over the fate of dozens more shows little signs of progress.

There are several specific steps that the United States can take to ensure it closes down Bagram by the time it ends combat operations next year. It should commit to a public timeline to resolve detainees’ cases and standardize the terms of repatriation, which could greatly expedite the negotiation process and make the U.S. and other governments more accountable for progress.

More sustained, strategic attention is also needed at higher levels within the U.S. government. The Special Representative on Afghanistan and Pakistan should press high-level Pakistani officials to commit to an agreed upon timetable for repatriation negotiations.  Doing so would compel higher-level Pakistani officials to take ownership over the issue and send a signal down the chain of the Pakistani government. The recently appointed Defense Department Special Envoy for Guantanamo Closure, who will also be responsible for transferring TCNs held in Afghanistan, could press for higher-level engagement among the United States and the detainees’ home countries.

Ongoing U.S. detention of TCNs at the DFIP ultimately points to persistent uncertainty regarding U.S. engagement in Afghanistan post-2014 and the inescapable challenge of reconciling U.S. interests and influence with Afghan law and sovereignty. What will be the scope of U.S. detention and targeting operations, and what will be the legal authority under international, U.S., and Afghan law for such operations? What does the end of U.S. combat operations mean for U.S. counter-terrorism operations in Afghanistan? How will U.S. operations be reconciled with Afghan sovereignty and the Afghan government’s own legal obligations?

Recent reports indicate that the BSA negotiations hit an impasse in part due to dispute over U.S. authority to conduct unilateral operations after 2014. In a little-noticed operation in September, U.S. forces captured Pakistani Taliban commander Latifullah Mehsud. Not only did the operation occur without Afghan sign-off (President Karzai strongly objected, calling it a violation of Afghan law and sovereignty) but Latifullah was reportedly forcibly taken from Afghan intelligence officials’ custody, and transferred to U.S. detention at Bagram. Though the BSA will now reportedly require the U.S. to “consult” Afghan authorities before launching operations, Latif’s capture and the political row it caused show that despite purported agreements, there are fundamental differences over the permissible scope and legality of U.S. detentions and military operations.

Unfortunately, ambiguity around these questions has often suited the United States.—and at times, Afghanistan—allowing officials to paper over differences, as has happened time and again with Bagram. Whatever language is agreed to in the BSA, the United States and Afghanistan should make clear how all aspects of U.S. engagement post-2014 will be consistent not only with U.S. legal obligations, but also with Afghan law and international legal obligations.

Doing so, and bringing an end to the U.S. war in Afghanistan, will be impossible without resolving TCN cases and ending U.S. detentions at Bagram. If concerted action is taken now, the United States can do so, and make sure Bagram does not become an even greater legal and political challenge after 2014.