Corruption is often associated with damage to state institutions and national economies due to the improper use of money. Yet in countries convulsed by conflict and violence, corruption also poses clear and present dangers to security.

For proof, look no further than war-torn Afghanistan, indisputably one of the world’s most corrupt countries. Here, state corruption is a big boon for the Afghan Taliban. In the latest Transparency International corruption rankings, Afghanistan is number 166: only Somalia, the world’s most failed state, and North Korea, its most dictatorial state, place lower. Bribes, vote rigging, illicit industries, Ponzi schemes—Afghanistan has them all. Western analysts and military officials have described corruption as Afghanistan’s top threat.

Anticorruption under President Ghani

Even much-ballyhooed anticorruption success stories in Afghanistan turn sour. In 2014, as part of a major antigraft campaign, newly inaugurated Afghan president Ashraf Ghani reopened the notorious case of Kabul Bank. Back in 2010, this institution — Afghanistan’s largest private bank — had collapsed after several officials stole nearly $1 billion, most of which had been deposited by international donors. Several of the officials had been convicted and received five-year prison sentences, which were widely criticized as too light. Others implicated in the scandal had never been prosecuted.

Under Ghani, new arrests were made and prison terms were lengthened. The Afghan government vowed not to stop its work until all of the embezzled money was recovered. And then, just a few months ago, news broke that one of the biggest perpetrators of the Kabul Bank fraud, a businessman sentenced to 15 years in jail, was actually walking free — and continuing to pursue and make deals. His prison term apparently is being served only at night.

The Fault of International Aid

Some critics contend that the United States and its international partners deserve some of the blame for Afghanistan’s corruption catastrophe because they poured so much money into a country with so little capacity to absorb it. The Special Inspector General for Afghan Reconstruction, a U.S. watchdog, seemingly unearths a new horror story every month — from a U.S.-funded $335 million power plant that is barely operational to U.S.-purchased airplanes costing between $400 million and $500 million that the Afghan air force was unable to use.

Corruption also helps drive support for and recruitment to the Taliban insurgency.

Critics also accuse the international community of supporting warlords and other power-brokers closely associated with corruption, and of “turning a blind eye” to many of the country’s crooked deals. Regardless of who is to blame for it, corruption disgusts and demoralizes common Afghans, and delivers body blows to an economy already reeling from the withdrawal of foreign troops and the consequent recession of the war economy.

The Taliban and ISIS Profit and Win Recruits

Corruption also helps drive support for and recruitment to the Taliban insurgency. Many Afghans despise the Taliban and desperately want it to disappear, and the Taliban, with its financial dependence on illicit industries, functions as an organized crime syndicate and is in fact a case study in institutional corruption.

Nonetheless, some Afghanis — bitter that the state seemingly spends more time enriching itself than empathizing with those in dire need of basic services, jobs, or justice — are willing to see the Taliban as the least bad option. They see the Taliban, warts and all, as a less-corrupt alternative to the state. In effect, corruption helps strengthen one of the Taliban’s core narratives, one constantly featured in the group’s propaganda: the Afghan government and state are corrupt and illegitimate. The result is that the Taliban gets people to join its cause. Or to give it food, money, shelter, space, or other forms of support. On top of that, the Taliban has promised a consistent paycheck to prospective foot soldiers — a benefit that the Afghan military has failed to guarantee for its own employees because corruption often results in pay being delayed or outright stolen. By combining its financial-based recruitment pitches with religious rhetoric, the Taliban further strengthens its appeal.

Many oft-cited reasons explain why the Taliban insurgency has grown stronger in recent months: the withdrawal of U.S. combat forces, which has left vulnerable Afghan troops to fend for themselves on the front lines; record opium harvests, which keep the Taliban financially sound even amid organizational infighting; and continued safe havens in Pakistan. Still, it is important not to forget that corruption also helps fan the flames of insurgency in a big way.

As long as Afghanistan’s impoverished citizens fail to receive sufficient support from a corrupt state that they believe does not and will not help them, then a critical mass of Afghans will find these offers too good to pass up.

Corruption Understood but Unassailable

The current Afghan leadership — especially President Ghani — is well aware of the links between corruption, insurgency, and instability. Ghani spent many years in Washington working at the World Bank and published a book called Fixing Failed States. He has talked tough about corruption, vowing to declare a “holy war” against it and referring to it as a “cancerous lesion” threatening the state’s survival. His intentions to combat it in a meaningful way are likely genuine. Unfortunately, in Afghanistan, the scourge of corruption is so entrenched and endemic that it is hard to know where to start. Waging a meaningful and impactful anticorruption campaign will be a terribly long slog.

And yet the stakes are high. Not only is Afghanistan’s economy tanking, but its security continues to deteriorate amid a rapidly expanding insurgency. The Taliban controls nearly a third of Afghanistan’s districts or enjoys a strong presence in them; it holds more territory now than it has at any other time since 2001.

Ominously, reports now abound that ISIS, which is developing a modest presence in eastern Afghanistan, is starting to take a page out of the Taliban’s book and dangling the incentive of attractive and regular salaries to potential recruits. Researchers claim that ISIS-aligned recruiters are providing regular, on-time monthly salaries of $700. That’s $400 more than the sum provided by the Afghan military, when payments are actually made, and a noteworthy figure given that Kabul actually announced pay increases for its security forces last year. Like the Taliban, ISIS is couching these appeals in the language of Islam.

As long as Afghanistan’s impoverished citizens fail to receive sufficient support from a corrupt state that they believe does not and will not help them, then a critical mass of Afghans will find these offers too good to pass up. Support for, and recruitment to, militant causes in Afghanistan will continue to flourish. This is bad news for stability, especially in a nation so desperate for some semblance of security.

The opinions expressed here are solely those of the author.

Michael Kugelman is the senior associate for South Asia at the Wilson Center. Follow him on Twitter @michaelkugelman.