The American and Afghan negotiators have been working hard in recent days to complete the draft so that it could be signed before a NATO conference in Chicago on May 20. There, decisions are to be made on how much money and support will be provided to the Afghan security forces after 2014 and by whom.

Lacking certainty about a long-term American commitment to Afghanistan, some countries were holding back, waiting to see what the United States, the leader in shaping Afghan policy, would do. Western diplomats said Sunday that the allies would now be more willing to make commitments.

The agreement — sweeping by design, with few details to bog down negotiators — puts down in writing for the first time the nature of the relationship the United States will have with Afghanistan once the bulk of American troops go home. It is meant to reassure the Afghan people that the United States will not abandon them, to warn the Taliban not to assume that they can wait out the West, and to send a message to Pakistan, which American officials believe has been hedging its bets in the belief that an American departure would leave the Taliban in charge.

“This is the proof in the pudding that we intend to be there,” one United States official said Sunday, speaking on the condition of anonymity because he was not authorized to speak publicly.

The agreement came despite a series of setbacks in Afghan-American relations, including the burning of Korans, the massacre of 16 civilians attributed to a lone Army sergeant, and the appearance of grisly photos of American soldiers posing with the body parts of Afghan insurgents.