According to a senior U.S. official, a key element to the agreement is that the Afghans can invoke a procedure that insures prisoners considered dangerous would not be released from the detention center.
NPR: US, Afghanistan OK Detention Center Transfer