Afghan National Police officers line up after their training session at a training centre in Kunduz, northern Afghanistan, on Dec. 3, 2012. (FABRIZIO BENSCH/REUTERS)

When Afghan and American negotiators sat down here last month to begin talks on a bilateral security agreement that would define and govern a long-term U.S. military presence in Afghanistan, their meeting was cordial, vague and brief.

When the two sides meet again this month for more substantive discussions, each will begin to lay out a competing set of military concerns, political constraints and legal priorities that could severely test their fledgling postwar partnership, possibly to the point of failure.

For the Afghan government, which has smarted under a decade of Western military dominance in the fight against Taliban and al-Qaeda insurgents, the key will be balancing the desperate need for continued U.S. support of Afghan security forces with the public and political pressure to ensure equality and sovereignty after U.S. combat troops leave Afghanistan in 2014.

“There is no question we would like to see a continued U.S. military presence to strengthen Afghan institutions and assure the Afghan people that the U.S. will be a friend and ally after 2014. But this must be an agreement between two sovereign nations,” said Jawed Ludin, Afghanistan’s deputy foreign minister. “Some see this as being mostly about immunity and jurisdiction, but we see it in the larger context. This is our future at stake.”

For the U.S. government, which has lost more than 2,000 troops in an increasingly unpopular war, the key will be addressing the Afghans’ demand for sovereignty without conceding the right to protect all American forces stationed here in supporting roles from potentially abusive treatment by Afghan authorities or courts.

“As much as I want to get it right in Afghanistan and believe losing would be a national security disaster for the ages, if the Afghans insist on keeping American soldiers in Afghanistan without legal protections . . . I will not vote for one penny, and this war will come to an end,” Sen. Lindsey O. Graham (R-S.C.), a member of the Senate Armed Services Committee, said at a hearing in Washington last month.

Last year, during similar negotiations about the role and status of U.S. troops in postwar Iraq, the Iraqi government refused to grant legal immunity for any troops. Despite months of efforts to reach a compromise, the issue ultimately killed the agreement, resulting in the hasty departure of all remaining American forces.

In Afghanistan, the issue was starkly dramatized in March, when Robert Bales, a U.S. Army staff sergeant, was detained after a late-night shooting rampage that killed 16 villagers. Afghan leaders argued that Bales should face justice in Afghan courts, but U.S. military officials swiftly returned him to the United States for prosecution.

While the international command headed by Gen. John R. Allen here is working on recommendations for President Obama on the rate of withdrawal for American combat troops, the U.S. negotiating position for the follow-on force is being formulated in Washington. Officials there said that options currently under discussion call for 5,000 to 10,000 troops, including training and logistics experts as well as counterterrorism units.

Although the rules governing the future activities and status of American troops are being negotiated in private by senior Afghan and U.S. officials — a process that is expected to take up to a year — the public atmosphere surrounding the talks has already been roiled by a string of criticisms and demands from Afghan President Hamid Karzai.

In the past several months, Karzai has declared that NATO members should not count on immunity after 2014. He has also lambasted the United States for not responding more aggressively to cross-border rocket attacks from Pakistan, and repeatedly demanded that the United States fund a larger Afghan air force.

Last month, Karzai also accused the United States of breaking an earlier agreement to turn over full control of Afghan prisons and detainees, including more than 3,000 prisoners being held at Bagram air base, and he ordered his aides to carry out the “full Afghanization” of all prisons.

Critics of the president, who is supposed to step down in 2014, when a new election is scheduled, say he has been grandstanding, mainly for domestic political reasons. Some suggest that he wants to cling to power and is using the security agreement to win personal concessions from the United States, even at the risk of sacrificing the entire pact.

But several other Afghan officials insisted that the government fully recognizes the importance of the agreement and is only seeking to protect its rights after a decade of subordination to Western military forces.

“This continued partnership is clearly in both countries’ interests, and there is no question that America’s security needs are important to us as well,” Ludin said. “But our fear is that the legalistic approach from the American side will miss the political gravity of it for us. We need a sense of reassurance that the Afghan laws and constitution will be respected.”

Afghan army and police commanders have repeatedly said they need an array of sustained U.S. support — from weapons to logistics to training — in order to defend the nation against Islamist insurgents. The Afghan public, although weary and resentful of the protracted NATO military presence, is also fearful of what will happen when Western forces leave.

Despite the stumbling blocks, U.S. officials in Kabul said they are optimistic that the security talks will go more smoothly than they did in Iraq. They said a solid bilateral security agreement, building on a broad strategic partnership agreement signed by Obama and Karzai in March, can help persuade the Afghan public that the United States will not abandon them.

In Washington, however, officials said there is little chance that the Obama administration will agree to any deal that allows U.S. troops to be handed over to Afghan authorities for prosecution and trial, citing concerns about corruption and bias in the Afghan justice system.

The United States has status-of-forces agreements with more than 100 other countries that spell out when they can prosecute U.S. troops under specified circumstances.

In Afghanistan, a legal agreement has for years allowed American authorities to prosecute U.S. troops for any alleged crimes committed there. Christopher M. Jenks, an assistant law professor at Southern Methodist University and a former military prosecutor, said it is hard to imagine that Afghan leaders would agree to extend that arrangement past 2014.

Even if negotiators try to paper over their legal differences, Jenks added, any agreement would quickly fall apart in a future case — such as the allegations against Bales — in which U.S. troops are accused of rape, murder or other atrocities.

“That’s all well and good until you have an incident,” Jenks said. “You can build a house of cards, but you run the risk of it all coming down.”

Whitlock reported from Washington. Karen DeYoung in Washington and Kevin Sieff in Kabul contributed to this report.