The handmaiden of peace is exhaustion. We are seeing that lesson in the killing fields of Afghanistan and Yemen. Fragile peace agreements are emerging in both conflicts, thanks to skillful diplomats. There are a hundred reasons why each negotiation may fail, and in assessing Middle East conflicts, we should remember that, unfortunately, “pessimism pays,” as my former Wall Street Journal colleague Karen Elliott House observed nearly 40 years ago.But a process has started: Zalmay Khalilzad, the U.S. special envoy, said Monday: “We have a draft of the [peace] framework that has to be fleshed out.” A senior Gulf official told a Washington gathering Monday night that because of U.N. mediation efforts, “we are at the beginning of the end in Yemen,” and that the war there is now moving from a military to a political phase.

Recent diplomatic efforts are bolstered by fatigue and frustration at the existing, costly stalemates in both battlefields. The Trump administration (despite the president’s own clumsy statements) has found a balance between saying (rightly) that the wars must end and (wrongly) setting a precise timetable for withdrawing U.S. military support. Ambiguity is the mother of peace deals.

Body counts can be misleading, since they don’t measure the underlying will to keep fighting, but they suggest the awful human cost. President Ashraf Ghani said last week that more than 45,000 Afghan security personnel have been killed since he took office in 2014. U.S. commanders say Taliban losses are even higher. Over the past 17 years, about 1,900 American soldiers have been killed in action and more than 20,000 wounded in Afghanistan.

The Yemen war has been a special nightmare for civilians. Since the war began in 2015, more than 22 million people, or about 75 percent of the population, are now in need of humanitarian assistance, 16 million now lack drinking water and sanitation and 15 million are “severely food insecure,” according to congressional testimony Tuesday by Director of National Intelligence Dan Coats.

Growing public outrage has been a factor in curbing both conflicts. In Afghanistan, a peace movement gathered strength last year, with marchers trekking hundreds of miles to attend rallies. Last year, the Taliban said it was ready for peace talks and the Afghan government issued a peace proposal. Ghani’s cease-fire during the Eid holiday in June was joined by the Taliban. In Yemen, humanitarian organizations have given voice to the millions of civilian victims there.

War has a momentum that’s hard to stop, even when there’s a broad yearning to end a conflict. Gen. John Nicholson, who spent much of the last decade serving in Afghanistan, said last September as he handed over command to Gen. Austin Scott Miller: “It’s time for this war in Afghanistan to end” and “the time for peace is now,” a view shared by Miller.

But generals don’t end modern wars; diplomats do. In an interview Tuesday, Nicholson credited Khalilzad for being “the right man at the right time” to turn the broad aspiration for peace among exhausted Afghans into reality. “Relationships matter in this part of the world,” he said, and Khalilzad, who was born in Afghanistan and has known Ghani since he was a boy, has a unique set of contacts.

Khalilzad’s offer to the Taliban: Stop harboring international terrorists and America will withdraw its troops. That’s the same basic deal U.S. mediators have been floating for years, but in addition to battle fatigue, there’s now the added motivation of a shared enemy in Daesh (ISIS).

Just as there’s a ladder of escalation in wars, there’s a ladder of de-escalation, too. In unwinding the Yemen conflict, U.N. mediator Martin Griffith began with a cease-fire agreement in the port city of Hodeida; next, perhaps, he can open the road to the capital of Sanaa; then, maybe, a cease-fire at Sanaa airport; then an exchange of prisoners. Eventually the momentum of conflict slows, and problems begin to be solved in a “political box,” as the Gulf official noted.

Democratic societies fight wars at a disadvantage. The public wants the decisive outcome of victory, but as wars grind on, and people watch the savage endgame live, they hate what they see. The wires get crossed: the putative “good guys” appear to be savage killers; the terrorizing insurgents come to seem the innocent victims.

What slows the killing machine are fatigue, popular rage at the human cost of continued fighting and peacemaking formulas that allow each side to claim a measure of success and avoid humiliation. These are the kind of delicate but essential deals that diplomats are struggling to craft in Yemen and Afghanistan. We should all hope they succeed.

David Ignatius is published twice weekly by THE DAILY STAR.

A version of this article appeared in the print edition of The Daily Star on January 31, 2019, on page 6.

The views and opinions of authors expressed herein do not necessarily state or reflect those of the Arab Network for the Study of Democracy