America's longest war is a war without an end. The Afghan campaign has been a brutal quagmire, claiming tens of thousands of Afghan lives and those of thousands of foreign soldiers. Sixteen years of conflict have failed to unseat the Taliban, who continue to gain supporters and seize territory.
Now, the government in Kabul is trying a new strategy. At an international conference in Kabul last week, the president Ashraf Ghani offered the Taliban political recognition "without any conditions".
A seat at the table and a part in the peace process is an astonishing offer from a government that has fought the Taliban since its very foundation. But Mr Ghani was backed by delegates representing 25 countries. “Today, the decision is in your hands,” he told the group, “Accept a dignified peace and come together to safeguard the country.”
The Taliban have yet to answer, but they have previously signalled their openness to some form of talks, even if a peace deal is a very long way away. The truth is, all sides are war weary. But it is not only the long war with America that has made the Taliban open to talks. They also fear a coming war, with an adversary who could damage them far more than the United States: ISIL.
The situation in Afghanistan is dire – and getting worse. Civilians are dying at an extraordinary rate, with attacks claiming more than 10,000 civilian lives in 2017. The Taliban are resurgent and continue to make territorial gains, as well as launching attacks in new areas, in particular the heavily-defended capital Kabul.
In September, Donald Trump announced a new strategy to increase US troops to 14,000. Airstrikes have increased. That, perhaps coupled with the sense that Mr Trump may well stay in Afghanistan for years, purely to avoid the political defeat of a retreat, appears to have shifted something among the Taliban's leaders.
In February, the group published an open letter to the “American people”, calling on Washington to enter into direct peace talks with them – but also warning that “even if the policy of force is continued for another hundred years, the outcome will be the same”.
Read more from Opinion
How serious the offer is is debatable. It may be a political gambit, made in the knowledge that it cannot be accepted.
The open letter explicitly ruled out talks with the Kabul government, which the Taliban does not acknowledge, but the US has always said talks must be alongside the Afghan government.
Moreover, the US knows that direct talks with the Taliban would legitimise the group. Few things would increase the prestige of the group – which, after all, is also a political organisation trying to gain support among other Afghan rivals – more than the image of US mediators sitting down opposite the Taliban. The group would tell its supporters that it had fought the superpower and dragged it to the peace table.
Nonetheless, Mr Ghani's offer, coming just weeks after the Taliban's open letter, is some form of a response.
As a political gamble, it is clever. The offer from Kabul is not merely to recognise the group – after nearly two decades as outlaws – but also offers the possibility that Taliban fighters and officials could be removed from international blacklists.
The effect of the offer will hopefully be to split the Taliban. Nearly three years ago, when the Afghan government announced that Mullah Omar, the group's long-time leader, was dead, it set off splits within the ranks of the Taliban. Those splits remain, especially after the death of his successor Mullah Mansour a year later.
Nor is political recognition the only carrot that the government in Kabul can offer. As reconstruction money moves into parts of Afghanistan, the Taliban has the opportunity to profit from cooperation, or see its rivals enriched instead.
But there is also a further aspect that may really be behind the change in the Taliban's mood. The militant group has a rival.
For the past three years, ISIL have made inroads into Afghan territory, even that controlled by the Taliban. They have attacked and murdered civilians, especially among the Hazara, a Shia minority. This is a problem for the Taliban, which has always tried to depict itself as attacking mainly foreign troops and institutions, as well as the Afghan government.
Essentially a domestic movement, the Taliban gains most of its support from the belief that it is protecting Afghans from foreign invaders. The appearance of ISIL puts it in a very dangerous position.
If Afghans began to feel that the Taliban were unable to protect them from ISIL, or if Afghans began to rally to ISIL's propaganda of a global “caliphate”, or if ISIL became more successful at attacking foreign troops – any of those could cause the Taliban to lose support among Afghans and threaten the very viability of the group.
ISIL therefore is a genuine threat to the Taliban, and one they know they can only counter by allying in some form with the Kabul government.
Many Afghans will be dismayed that the Taliban, who were responsible for both cruelty and death for years before 2001, should be offered a way back to respectability. But such are the political compromises and contortions of a country that, for decades, no outside power has been able to subdue.
It may well be that after nearly two decades of fighting, what finally forces the Taliban to the peace table is the threat of another militant group birthed from a foreign war far away.