* Kerry's visit seen as last-ditch effort before deadline
* Afghan traditional assembly to decide on outcome - Karzai
* Kerry and Karzai say all other major issues resolved
U.S. Secretary of State John Kerry and Afghan President Hamid Karzai ended two days of talks on a bilateral security pact on Saturday without a deal because they could not agree on the issue of legal immunity for U.S. troops.
The pact would determine, among other things, how many U.S. troops remain in Afghanistan after 2014 when most foreign combat troops are due to exit.
U.S. officials had previously said they wanted the pact finalised by the end of October. Kerry's visit was seen as a last-ditch effort to push the deal through before the deadline.
The United States is insisting it cannot agree to a deal unless it is granted the right to try U.S. citizens who break the law in Afghanistan at home in the United States.
Karzai said that was beyond the scope of his government to decide on the issue, calling it a question of "jurisdiction", and that it would have to be put to the country's Loya Jirga, an assembly of elders, leaders and other influential people.
"We need to say that if the issue of jurisdiction cannot be resolved, then unfortunately there cannot be a bilateral security agreement," Kerry said at a news conference, stressing an agreement was otherwise essentially in place.
Karzai said the talks had focused on protecting Afghan sovereignty and that major differences had been resolved, including a U.S. request to to run independent counter-terrorism missions on Afghan territory.
Such operations carried out by the U.S. have long infuriated the Afghan president, who had been demanding the U.S. agree to share intelligence instead.
Karzai said the U.S. snatching of a senior Pakistani Taliban commander was an example of the kind of action that Afghanistan wanted to avoid.
"This is an issue that we have raised in earnest with the United States in the past few days as we have all previous occasions of such arrests in which the Afghan laws were disregarded," Karzai said, referring to the capture of commander Latif Mehsud.
"Therefore our discussion today in particular has been focused on making sure that through the bilateral security agreement such violations are not repeated."
Kerry attributed the complaint to a misunderstanding.
"We followed the normal procedures that the United States follows ... we did what we are supposed to do," he said.
The Afghan government rejected an initial U.S. proposal on immunity at the start of the year and it has been a sticking point ever since. The failure to reach a deal could prompt the U.S. to pull all its troops out after 2014, in 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 (BSA) during the visit, but Washington is concerned that as Afghan election campaigning intensifies it will be harder to broker a deal.
Karzai's brothers this week began their campaign to take power and plan to offer the outgoing president, constitutionally barred from running again, a position in their government.
The April election is seen as the most crucial since the U.S.-led overthrow of the Taliban in 2001, which brought Karzai to power.
International aid donors, who provide Afghanistan with the bulk of its income, hope a transfer of power will enable the country to move beyond years of damaging allegations of corruption and maladministration.
In an interview this month, Karzai blamed corruption on irresponsible spending by donors and said coalition troops had brought nothing but suffering because security was still poor.
Security has been deteriorating, increasing worry about the country's prospects after Western forces leave. On Saturday, a car bomb killed four people in the eastern city of Jalalabad.
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".
The Afghan president said the question of whether Afghanistan would be able to try U.S. citizens for crimes committed on its territory could not be decided by his government.
"The issue of jurisdiction is one such issue that is beyond the authority of the Afghan government and it is only and entirely up to the Afghan people to decide upon through two mechanisms," said Karzai, referring to the country's traditional assembly and its parliament.
Kerry said U.S. troops operated under the same standards wherever they were deployed.
"Wherever our forces are found, they operate under the same standard," he said. "We are not singling out Afghanistan."