THE SLAYING Monday of a women’s advocate in Afghanistan underlined one of the greatest dangers of the approaching withdrawal of U.S. and NATO troops: that the fragile gains of women in the 11 years since the downfall of the Taliban will be reversed. Though the international mission in Afghanistan has fallen short of many of its goals, the lives of the country’s women have improved: Some 3 million are now in school, compared to none in 2001; 10 percent of the judiciary and 20 percent of university graduates are female.

However, with its ability to challenge NATO and Afghan troops diminished, the Taliban is increasingly targeting people like Najia Seddiqi, the director of the women’s affairs department in the eastern province of Laghman, who was gunned down as she headed to work. Her predecessor was also murdered, by a bomb planted under her car, after she protected a young woman who refused to marry a man she had been promised to. Such attacks can be expected to intensify as U.S. troops withdraw from provincial areas in favor of an Afghan army that, according to the Pentagon’s latest report, is unprepared to defend the country on its own.

Rising violence is not the only threat. Both the Obama administration and the Afghan government are seeking negotiations with the Taliban in the hope of reaching some kind of political settlement before the end of 2014, when all U.S. combat troops are due to be withdrawn. Advocates for women fear that women’s rights will be “traded away in the transition,” as Amnesty International puts it. The group recently sponsored an open letter to President Obama and Afghan President Hamid Karzai, signed by prominent women from around the world, urging a deal that “affirms the constitutional guarantee of equality for women and men” and “contains robust monitoring mechanisms for women’s rights.”

As a first step, Amnesty and other groups are supporting legislation introduced by Sens. Robert P. Casey Jr. (D-Pa.) and Kay Bailey Hutchison (R-Tex.) as an amendment to the National Defense Authorization Act (NDAA). It would require the Defense Department to develop a three-part strategy for the security of Afghan women during and after the U.S. withdrawal. Among other things, it would mandate the collection of data on women’s security and the consideration of those facts in decisions about turning areas of the country over to Afghan forces. The Pentagon would also be required to produce a plan for the recruitment and training of women for the Afghan army and police.

The legislation passed the Senate as part of the NDAA, which now awaits action by a conference committee. It should be approved. The murder of Ms. Seddiqi is a terrible reminder that the United States must not abandon Afghanistan’s women as it leaves that country.