The US-led war in Afghanistan officially ended this week, after 13 long, hard, and costly years. The war's end is largely a technicality — US and other troops will remain, and the Afghan army is continuing to fight a losing war against the Taliban — but this is a still a symbolically rich moment in the winding down of Western involvement.

Few things sum up the bitterness of America's 13-year-effort in Afghanistan like the single sentence beneath this Al Jazeera headline, about NATO's ceremony officially "ending" the war. (Hat tip to Paul Szoldra, executive editor of the military news site WeAreTheMighty.com, for flagging this.)

Yes, that's right: the ceremony in Kabul honoring 13 years of mostly-American and British troops fighting and dying in Afghanistan had to be held in a secret location because the war has gone so badly that even the capital city is no longer safe from the Taliban.

It's not exactly like the 1975 fall of Saigon, when helicopters rushed the last Americans out of Vietnam from the rooftop of the US embassy, but it's a disturbing echo.

While the war largely succeeded in its initial aim of ejecting al-Qaeda from Afghanistan's government and eroding the group's strength, it has failed utterly in its larger effort to defeat the Taliban and turn war-ravaged Afghanistan into a stable, peaceful place — something that NATO implicitly had to acknowledge by holding this week's ceremony in secret.

The Taliban is still strong in rural areas of Afghanistan, and has been growing stronger, reaching even into once-safe Kabul to launch terrorist attacks. The Afghan government is in shambles, with no official cabinet or a functioning democracy despite a decade-plus of extremely expensive American efforts to build one. Afghan politics are divided and dysfunctional. The economy is propped up by foreign aid. Afghans are warily awaiting the return of Taliban rule.

American military and political leaders are aware that they are leaving Afghanistan in a terrible state. President Obama, in marking the official end of combat missions, said, "Afghanistan remains a dangerous place, and the Afghan people and their security forces continue to make tremendous sacrifices in defense of their country," which is code for "there is still a lot of bad fighting happening."

This is not to criticize Obama's decision to withdraw the US from the war, and thus begin to end involvement. After 13 years of trying, it may have simply been time to admit defeat. And this is most certainly what defeat looks like.