KABUL, Afghanistan — The war in Afghanistan has raged for nearly 18 years, cost billions of dollars, shattered countless families and consumed the administrations of three American presidents. But it has taken a particularly heavy toll on Afghan troops and police officers, 45,000 of whom have been killed in the past five years of fighting alone.

The fate of more than 35 million Afghans, including the 300,000 members of the Afghan security forces, could soon be decided over a negotiating table hundreds of miles away in Doha, Qatar, where the Taliban and the United States are trying to reach an agreement to have Western troops withdraw from Afghanistan.

Members of the security forces have put their lives on the line for a government that many now think will concede too much to their enemies. Some observers believe the military has been so ineffective — plagued by corruption, prone to infiltration, and lacking in leadership — that the government has no choice but to cut a deal.