America is creaking towards an ugly win in Afghanistan. With the growth of the Afghan Local Police (ALP) program and the currently successful presidential elections, we’re finally creating something that looks more like historical Afghanistan and less like the imagined Geneva-on-the-Helmand of 2001. Historical Afghanistan might be ugly; but an ugly win is still a win.

In terms of the endgame, Afghanistan was always a riskier war than Iraq. Both have been routinely compared with Vietnam, because of the counterinsurgency element, the godforsaken element, and perhaps some national psychological masochism. Even less-gloomy Americans were occasionally visited by the shade of helicopters lifting off the roof of the American Embassy in Saigon, one jump ahead of the hit man and the North Vietnamese Army.

Related: Endgame in Afghanistan—Just 3,000 Vulnerable Troops

In Iraq, that was an absurd comparison. The US invasion disenfranchised a minority Sunni regime and placed the Shia majority in power. For all the talk about democracy, that was the realpolitik result. Shorn of their post-colonial advantages, the Sunnis who comprised most of the insurgency would almost certainly never again rule Iraq, simply by weight of numbers. Absent a general uprising among Shias, there was not an existential threat to the new Iraqi government.

Afghanistan is quite different. There we are fighting an insurgency based in the Pashtuns, a majority ethnic group that has always ruled modern Afghanistan. If the Taliban regained enough support among that base, their overthrow of the Kabul would be very possible.

The saving grace for us is that Afghanistan doesn’t have to have a strong central government. Since the founding of the modern state under Ahmed Shah in 1747, the history of the Afghan government has been one of constant negotiation between the center and the periphery. Though on the daily edge of anarchy, the periphery’s loyalties could be rented by a mixture of bribery, flattery, and brutality. Under competent leadership, like Ahmed Shah, local powerbrokers along the periphery have been mostly allied to the center. Under incompetent rulers like his son Timur, they have been violently less so.

Unsurprisingly, despite earlier Western efforts, Afghanistan keeps trying to reboot to its default setting. The Afghan war looks like a patchwork of highly local, messy tribal feuds because…Afghanistan is mostly a patchwork of highly local, messy tribal feuds. To force it to be otherwise is ahistorical -- and for too long the US and NATO policy have been ahistorical.

For example, why does Afghanistan need a national police force? The US doesn’t have a national police force, nor would we likely accept one. Why would we encourage total strangers and ethnic enemies to come into tribal Pashtun villages and enforce order? We’d probably have better luck using Martians to enforce order, if we had Martian battalions with some basic counterinsurgency training. Say what you will about the carnivorous tripods from War of the Worlds, but at least the Ghilzai Pashtuns have no preexisting ethnic antipathies towards them.

Related: The Afghan Report that Could Have Saved the US Billions

There are two recent reasons for optimism, however. One is the growth of the Afghan Local Police (ALP), which began in 2010 as a program that recruited rural Afghans to protect their own villages. Stationed in their own villages, ALP members knew who Taliban was and who was not.

The ALP has been so strategically successful that their authorization has expanded from 10,000 to 30,000 fighters, with about 24,000 as of October 2013. Though there have been some well-publicized problems, localism works. The most recent Pentagon report on the war said that the ALP was “one of the most resilient institutions in the ANSF,” or Afghan National Security Forces, with the ANSF’s highest casualty rate and one of the lowest monthly attrition rates.

The ALP has been so successful because it is an institution that reflects, belatedly, the historically local basis of Afghan governance and power. The effectiveness of that localism comes with a cost, obviously: increased distance from Kabul’s control and supervision. Currently, the ALP’s partnership with US special operations forces keeps ALP members within fairly tight left-and-right limits of behavior. As US forces draw down, that supervision will be replaced by Kabul’s ability to manage them and the district police chiefs nominally in charge.

Related: Afghanistan’s Surprises

Probably, those left and right limits will expand somewhat. This is provincial Afghanistan, after all, not the Upper West Side. There will be a basic Ten Commandments for local security forces aligned with Kabul and the US: thou shalt not harbor Al-Qaeda’s Most Wanted; thou shalt not abuse prisoners; thou shalt send some of your girls to school. But it’s better – for them and for us – than what came before. By recognizing that, US efforts are tacking closer to something that looks like an historically sustainable Afghan state.

The second necessity for victory is a responsible-looking central government with which foreign countries can interact. To be a sustainable recipient of Western aid, Afghanistan simply must have a more sympathetic government than Hamid Karzai or somewhat thuggish local power brokers. Only with a regular supply of Western aid will the Kabul government be able to bribe the regional powerbrokers to tilt towards it, and stay within our commandments. And if they don’t – if they really don’t, and flaunt it – then eventually they may have to die. An American high-end special operations capability in Afghanistan is critical not for Al-Qaeda and other transnational terrorists, but also to drop the hammer if local warlords step too far out of line.

It’s thus not unreasonable to be optimistic about Afghanistan. Finally, our prefab Afghan institutions are beginning to look like traditional Afghan institutions. Continuing to expand the ALP program, and removing its officially “temporary” status, would bring them closer yet. The canonization of local power centers, combined with a responsible-looking Afghan government in Kabul, can constitute a sustainable solution, even a win. And one within our left and right limits, broadly speaking.

Top Reads from The Fiscal Times: