2 Afghan police, 3 insurgents killed in attack

An Afghan police official says insurgents attacked a checkpoint in eastern Afghanistan and that two border policemen and three attackers were killed in the ensuing firefight.

Regional border police spokesman Edris Mohmand says insurgents assaulted the checkpoint in Lalpur district of Nangarhar province Friday. The area is near the border with Pakistan.

The assault resulted in a three-hour gunbattle between the police and the assailants.

THIS IS A BREAKING NEWS UPDATE. Check back soon for further information. AP's earlier story is below.

KABUL, Afghanistan (AP) - The U.S. military and the Afghan government sealed an agreement Friday on the gradual transfer of control of the main U.S. prison in the country, a last-minute breakthrough that brings the first progress in months in contentious negotiations over a long-term partnership.

The compromise deal came on the day Afghan President Hamid Karzai had set as a deadline for the Americans to hand over the Parwan prison.

The agreement gives the U.S. six months to transfer Parwan's 3,000 Afghan detainees to Afghan control. However, the U.S. will also be able to block the release of prisoners, easing American fears that insurgents or members of the Taliban could be freed and return to the fight.

The deal removes a sticking point that had threatened to derail talks that have been going on for months that would formalize the U.S.-Afghan partnership and the role of U.S. forces in Afghanistan after NATO's scheduled transfer of security responsibility to the Afghan government at the end of 2014.

On Thursday, U.S. President Barack Obama and Karzai discussed the stalled security pact talks in a video conference. White House press secretary Jay Carney said the two leaders noted progress toward completing an agreement "that reinforces Afghan sovereignty while addressing the practical requirements of transition."

Another major sticking point in the negotiations remains unresolved: night raids by international troops on the homes of suspected militants. Karzai has demanded a halt to the raids, which have caused widespread anger among Afghans.

U.S. and Afghan officials have said that they want a strategic partnership agreement signed by the time a NATO summit convenes in Chicago in May.

Gen. John Allen, the commander of U.S. and NATO forces in Afghanistan, called Friday's deal a sign of real progress toward the larger partnership accord.

"This is an important step. It is a step forward in our strategic partnership negotiations," Allen told reporters in the capital before signing the agreement alongside Afghan Defense Minister Abdul Rahim Wardak.

The deal gives the Americans the extension they wanted for Parwan, a U.S.-run prison adjoining its Bagram military base north of Kabul, but also spells out an American commitment to a firm transfer date for the first time. Previously, the U.S. has always offered "target dates" rather than deadlines.

Under the deal, an Afghan general will be put in charge of Parwan within days, but the Americans have a six-month window to transfer detainees to Afghan oversight, according to presidential spokesman Aimal Faizi.

The U.S. military will still be able to monitor operations. It will continue to provide logistical support for 12 months, and a joint U.S.-Afghan commission will decide on any detainee releases until a more permanent pact is adopted, according to U.S. officials involved in the negotiations - a setup that will essentially give U.S. officials power to veto any release. The Afghans also have agreed to grant human rights groups regular access to detainees. Last year, the United Nations found evidence of torture at a number of Afghan-run prisons.

The officials, who spoke anonymously to discuss confidential talks ahead of the signing, said the first 500 detainees are expected to be transferred in 45 days. The U.S. government had already handed over a few hundred detainees to the Afghans before the agreement was signed.

The officials said the deal does not apply to the approximately 50 non-Afghans at Parwan, who will remain in U.S. custody.

The officials also said that they still need to work out how to handle new detainees. Currently, the U.S. military assesses whether people captured on the battlefield are a threat and then either lets them go, hands them over to Afghan authorities or sends them to Parwan.

The U.S. also operates what it has described as temporary holding pens for gathering intelligence from detainees in Afghanistan; officials have confirmed anonymously that some detainees have been held at these centers for up to nine weeks. The agreement does not appear to address these sites.

Friday's memorandum comes as relations between the U.S. and Afghanistan have become more tense in recent weeks following the burning of Qurans and other religious materials at Bagram, sparking riots and attacks that killed some 30 people.

The U.S. has apologized and said the Qurans came from the Parwan detention center and were taken out because they had extremist messages written in them, but that they should not have been sent to be burned. Karzai said soon after the Quran burnings became public that these types of incidents would not occur if the Afghans were in charge of the detention facility.

The issue of night raids, meanwhile, still has to be resolved.

The raids target insurgents, but Karzai has said civilians are too often rounded up or killed when raids turn violent. He insists that if there are night raids, Afghan troops should conduct them alone.

The U.S. officials said talks are already under way on a separate memorandum governing night raids.

The U.S.-Afghan strategic partnership is expected to provide for several thousand U.S. troops to stay and train Afghan forces and help with counterterrorism operations. It would outline the legal status of those forces, their operating rules and where they would be based.

The agreement is also seen as a means of assuring the Afghan people that the U.S. does not plan to abandon their country, even as it withdraws its combat forces.