The United States, its NATO partners and Afghanistan voiced confidence Wednesday an agreement will soon be reached to allow some alliance troops to remain after next year's withdrawal.

The US-Afghan Bilateral Security Agreement (BSA) is intended to lay out out the role and legal framework for US soldiers to stay in Afghanistan as part of a NATO training and advisory mission, but has been bogged down in disagreement over troop immunity.

"If it works out as planned, we can get an agreement pretty soon," US Defence Secretary Chuck Hagel said.

A BSA will in turn pave the way for a separate but similar Status of Forces accord with NATO member states to provide troops.

US Secretary of State John Kerry visited Kabul earlier this month to thrash out an accord with President Hamid Karzai, who had threatened to abandon talks as he criticised the whole NATO effort in Afghanistan.

After difficult and protracted negotiations, the two sides produced a draft accord which will be submitted for approval next month to a Loya Jirga -- a gathering of tribal elders and civil leaders -- in Afghanistan.

Details of the draft have not been released.

NATO head Anders Fogh Rasmussen said the BSA was "obviously a very important topic," and welcomed the progress made.

Rasmussen said he was "confident that the BSA will be concluded", clearing the way for the post-2014 mission.

Afghan Defence Minister Bismillah Khan Mohammadi told a press conference after a NATO defence ministers meeting in Brussels that he was "very optimistic" the Loya Jirga would endorse the BSA, with parliament approval to follow directly.

He said that the NATO Status of Forces agreement would likely be approved at the same time but if not, parliament could clear it shortly afterwards.

If the BSA is put in place, it is expected up to 10,000 US troops could stay in Afghanistan to help fight Al-Qaeda remnants and train the national army.

The US has provided the bulk of NATO forces in Afghanistan, which have been steadily reduced to 87,000 in preparation for the 2014 withdrawal.

The difficult BSA talks had raised fears that Afghanistan could suffer the same fate as Iraq where the collapse of a similar security agreement in 2011 led to the US pulling all its troops out.