Updated

U.S. Secretary of State John Kerry is in Afghanistan for urgent talks with Afghan President Hamid Karzai.

They will discuss a looming end of October deadline for completing a security deal to allow American troops to remain in Afghanistan after the end of the NATO-led military mission next year.

Kerry's unannounced visit to Kabul on Friday comes as talks on the Bilateral Security Agreement have foundered over issues of Afghan sovereignty despite a year of negotiations.

The U.S. wants a deal by the end of the month, but the discussions have stalled over Karzai's demand for American guarantees against future foreign intervention, a veiled reference to neighboring Pakistan. The U.S. wants any remaining troops to be able to conduct counterterrorism and counterinsurgency operations.