US Secretary of State John Kerry and Afghanistan President Hamid Karzai have said that major issues over a bilateral security agreement had been resolved but the question of immunity for US troops would have to be decided by a assembly of elders and leaders.

The agreement would help determine, among other things, how many US troops remain in Afghanistan after 2014 when most foreign combat troops are due to leave. US officials have previously said they want the pact finalised by the end of the month.

If this thing can come together, this will put the Taliban on their heels.

Aimal Faizi, spokesman for Hamid Karzai

Currently, there are 52,000 American troops in Afghanistan and the US wants to keep as many as 10,000 soldiers there. If no agreement is signed, all US troops would have to leave.

Kerry began negotiations with Karzai on Saturday morning, the second day of talks after he arrived late on Friday. Kerry's unannounced overnight visit to Kabul came after talks were repeatedly stalled in recent weeks.

Karzai is demanding US guarantees in defending Afghanistan against foreign intervention, an allusion to neighbouring Pakistan. The US wants any post-2014 forces to be able to conduct counterterrorism and counterinsurgency operations.

Al Jazeera's Jane Ferguson, reporting from Baghlan, said Karzai had outlined Afghan demands, including a provision for the protection of civilians from US forces and agreement that the US must seek permission from Afghan authorities for future military operations.  

The talks, that began a year ago, have been deadlocked over sovereignty issues and the safety of Afghan citizens at the hands of American and allied troops.

"If this thing can come together, this will put the Taliban on their heels," said Karzai spokesman Aimal Faizi.

The agreement is necessary to give the US a legal basis for keeping forces in Afghanistan after 2014 and also to allow it to lease bases in the country. It would be an executive agreement, meaning the US Senate would not have to ratify it.

Source: Al Jazeera and agencies