American military commanders long ago concluded that the Afghan war could only end in a negotiated settlement with the Taliban, not a military victory. But now the generals and civilian officials say even this hope is unrealistic before 2015 — after American and coalition troops are withdrawn. They are, instead, trying to set the stage for eventual peace talks between the Afghan government and the insurgency sometime after their departure.

President Obama’s failure to make headway in talks with the Taliban is a serious setback. Of course, persuading militants to negotiate a peace deal was always a daunting challenge. But the Obama administration has not been persistent enough in figuring out how to initiate talks with a resilient, brutal insurgency that continues to carry out deadly attacks against American and NATO forces.

During the 2010 surge, when the United States added 33,000 troops to the 68,000 in Afghanistan and put maximum military pressure on the Taliban, the administration was conflicted and too cautious about pressing for talks. Top generals resisted negotiations, saying the focus should be on military gains. Even after the administration decided in February 2011 to pursue talks, it took officials months to agree on the details of their approach.

The talks between the United States and the Taliban began early this year but soon collapsed when the administration, faced with bipartisan opposition in Congress, could not complete a proposed prisoner swap. The Taliban wanted five of their leaders released from Guantánamo Bay, Cuba, in exchange for the sole American held by the insurgents, Sgt. Bowe Bergdahl. The risky deal was supposed to be a confidence-building mechanism to encourage more serious talks. But its collapse has made talks even harder.

The Taliban are internally divided and unwilling to meet Washington’s demands to sever all ties to Al Qaeda, renounce violence and accept the commitments to political and human rights in Afghanistan’s Constitution. Pakistan has long played a destructive role, enabling Taliban groups and refusing to support negotiations. Even a more basic outreach to the Taliban — the so-called reintegration program that seeks to get lower-level fighters to lay down their arms — has enticed only 5,000 of an estimated 20,000 to 30,000 insurgents off the battlefield.

Still, the United States has not and should not give up completely on a negotiated solution or at least some movement toward reconciliation. And it can’t wait until 2014 or later. Although there are no formal talks under way, there are contacts between the Taliban and Afghans and others. Pakistan recently urged the insurgents to join the political process and agreed to help Washington vet potential new Taliban interlocutors. It shouldn’t take long to see if Pakistan’s Army is serious.

The 2014 presidential election is critical to any peace deal. One idea under discussion: an interim agreement under which the Afghan opposition, the Taliban and others might endorse minimum objectives rejecting Al Qaeda and supporting an inclusive political system. The goal would be to elect a broadly accepted new president better suited to lead than Hamid Karzai, whom the Taliban considers an American puppet and resists reform.

Given Afghanistan’s history, it’s hard to be optimistic. But with American troops leaving Afghanistan, there should be an interest in advancing a political system that insurgents might see as an alternative to armed conflict.