WASHINGTON — The U.S. reached an agreement with the Afghanistan government to transfer the Parwan Detention Facility to Afghan control, the Pentagon said Saturday, two weeks after negotiations broke down over whether the U.S. would have the power to block the release of some detainees.

According to a senior U.S. official, a key element to the agreement is that the Afghans can invoke a procedure that ensures prisoners considered dangerous would not be released from the detention center. The agreement also includes a provision that allows the two sides to work together to resolve any differences. The official spoke on condition of anonymity.

Transfer of control of the Parwan detention center Monday is critical to the effort to gradually shift the country’s security to the Afghans as the U.S. and allies move toward the full withdrawal of combat troops by the end of 2014.

Afghans demanded control of the center, but U.S. officials have worried that the most threatening detainees would be freed once the U.S. transferred control. Defense Secretary Chuck Hagel spoke with Afghan President Hamid Karzai on Saturday as officials finalized the agreement.

Unlimited Digital Access. $1 for 4 weeks.

The senior official said U.S. and Afghan officials familiar with the detainees would meet to assess the potential danger of their release to coalition forces. The official said more senior-level officials could be brought in if there are disagreements but that to date the two sides have agreed without bringing in higher authorities.

Currently, there is an Afghan administrator of the Parwan prison, but the Americans have power to veto the release of detainees. The prisoners held under American authority do not have the right to a trial because the U.S. considers them part of an ongoing conflict.