KABUL U.S. Secretary of State John Kerry and Afghan President Hamid Karzai have reached preliminary agreement on a bilateral security pact that now depends on the approval of Afghanistan's tribal leaders.
The pact, announced jointly by Kerry and Karzai late on Saturday after two days of talks in the capital, Kabul, would keep some U.S. forces in Afghanistan after the withdrawal of most foreign troops by the end of next year.
The draft includes a U.S. demand to retain legal jurisdiction over its troops who stay on in Afghanistan, which would give them immunity from Afghan law.
Karzai opposes that and said the question could not be decided by his government. Instead, a Loya Jirga, or an assembly of elders, leaders and other influential people, will consider the demand and decide whether to accept it.
The United States is insisting it cannot agree to a deal unless it is granted the right to try in the United States its citizens who break the law in Afghanistan.
"We need to say that if the issue of jurisdiction cannot be resolved, then unfortunately there cannot be a bilateral security agreement," Kerry told a news conference.
U.S. officials said they wanted the pact finalised by the end of October and Kerry's visit was seen as a last-ditch effort to push it through before the deadline.
A senior U.S. administration official said the sides had agreed on language in the draft deal that covers the issue of immunity and "that can be put to his Loya Jirga for their consideration".
Hundreds of people, and at times even more than 1,000, attend a Loya Jirga, which makes it difficult to predict how deliberations will unfold.
However, in the past, they have voted in favour of keeping a U.S. presence in Afghanistan and Western diplomats are optimistic the assembly will pass the deal - as long Karzai remains in favour of it.
"The Loya Jirga here basically follows the advice of the president, and I think he will (agree to the pact)," said one senior diplomat.
Karzai said the assembly would be held within a month.
Karzai said the talks had focused on protecting Afghan sovereignty and that major differences had been resolved, including a U.S. request to run independent counter-terrorism missions on Afghan territory.
Such operations carried out by the United States have long infuriated the Afghan president, who had been demanding that the United States agrees to share intelligence instead.
Karzai said the recent U.S. snatching of a senior Pakistani Taliban commander on Afghan soil was an example of the kind of action that Afghanistan wanted to avoid.
"Our discussion today in particular has been focused on making sure that through the bilateral security agreement such violations are not repeated," he said.
On the U.S. demand to retain legal jurisdiction over its troops, Kerry said U.S. forces operated under the same standards wherever they were deployed.
"We are not singling out Afghanistan," he said.
The Afghan government rejected an initial U.S. proposal on immunity at the beginning of the year and it has been a sticking point ever since. The failure to reach a deal could prompt the United States to pull out all of its troops by the end of next year, an outcome known as the "zero option".
It was considered almost unthinkable a few months ago, but U.S. officials have since raised the possibility, with an implicit warning that Afghan security forces are not ready to fight the Taliban-led insurgency without their help.
The collapse of similar talks between the United States and Iraq in 2011 - partly over the issue of immunity - led to the United States completely ending its forces' mission there rather than maintaining a significant presence.
U.S. officials had said earlier that Kerry did not intend to close a deal on the Bilateral Security Agreement during the visit, but Washington is concerned that as campaigning intensifies for Afghanistan's April election, it will be harder to broker a deal.
The election is seen as the most crucial since the U.S.-led overthrow of the Taliban in 2001, which brought Karzai to power.
Security has been deteriorating recently, increasing worry about the country after Western forces leave.
Efforts to draw the Taliban into negotiations have come to nothing. The militants say they will fight on until all foreign forces leave and they dismiss Karzai as a U.S. "puppet".