The nearly 17-year-old Afghanistan conflict, the longest war in United States history, will not end on the battlefield. It can be resolved only at the negotiating table. So, the bold offer last month from President Ashraf Ghani of Afghanistan to negotiate with the Taliban “without preconditions” is a welcome initiative. But it faces daunting obstacles.

Mr. Ghani’s proposal envisions an outcome in which the Taliban would be recognized as a legitimate political party, prisoners would be released and United Nations sanctions against the group would be lifted. In exchange, the Taliban would have to recognize the Afghan government and respect the rule of law, including women’s rights.

Secretary of Defense Jim Mattis, during a surprise visit to Afghanistan this week, said there was evidence that some Taliban factions are interested in talks. The Taliban have not responded formally to Mr. Ghani’s proposal, but in the past they have refused to negotiate directly with the Afghan government, which they deem an American puppet. Instead, the Taliban have insisted on direct talks with the United States that exclude the Kabul government, as a way to discredit it. The United States has long supported an Afghan-led peace process, in which Washington might play a role but would not stand in for the Afghan government.

Assuming the Taliban refuse Mr. Ghani’s offer, it’s timely to ask: Is there an alternative to an indefinite United States military presence in Afghanistan?