Afghanistan is losing cash. Kabul only collects around $2 billion annually and the majority of that comes from customs—the money importers pay to bring goods into the country. Now that number is falling fast.

Imports are an important part of the Afghan economy, and helps keep the central government afloat. The income fluctuates year to year, but customs revenue makes up between a third to half of the country’s total income. During 2012, Kabul collected $1.1 billion at its borders.

The number of American border agents and soldiers in the country has also fallen in the past few years. Last year, the U.S. handed control of regulating the borders over to their Afghan counterparts.

The results are dramatic. Afghanistan is on track to make $600 million off its borders this year, almost half what it made just three years ago. American officials in the country think they know why the number’s going down, but it’s not because of fewer imports.

“Approximately half of the customs duties for Afghan fiscal year [2015] are believed to have been stolen,” the U.S. Special Inspector General for Afghanistan Reconstruction wrote in a recent letter to P. Michael McKinley, the U.S. ambassador to Kabul.

“These continued economic conditions could lead to another shortage in revenue that will likely require the Afghan government to obtain additional assistance from the international community and the U.S. government,” SIGAR added.

In 2014, Kabul didn’t make enough money to pay its employees or deliver basic services. Washington pulled $100 million out of a reconstruction trust fund to keep the government afloat. It’s probably not the last time American taxpayers will pay to keep the lights on in Kabul.

To put it simply—Afghanistan has a corruption problem. Kabul runs on a network of bribes and patronage, and it’s hard to get anything done without paying off officials. The United Nations estimated that half of all Afghanspaid some form of a bribe in 2012.

Total cost of those bribes? Almost $4 billion. Kabul collected about $2 billion in revenue that year. That means government officials collected double in bribes what they did in taxes and custom duties.

“The great challenge to Afghanistan’s future isn’t the Taliban,” John Allen—retired general and former head of the U.S. forces in Afghanistan—told a Senate Foreign Relations Committee in April last year.

“The existential threat to the long term viability of modern Afghanistan is corruption.”

Afghanistan’s lost income due to corrupt border guards is a microcosm of the country’s biggest problem—that the central government can’t govern if officials continue to skim off the top.

At some of the borders, goods entering the country must go through 30 different steps before customs agents allow them to enter. That’s a ridiculous number.

The import process and number of steps varies between countries. But according to the U.S. Agency for International Development, the world standard is around 13 steps.

To battle graft and drive up revenue numbers, USAID officials attempted to simplify the import process in Afghanistan by automating or removing steps. But corrupt Afghan customs agents have thwarted the changes.

“Reducing the number of customs process steps is often met with resistance because each step allows for the associated official to demand payment from an importer,” SIGAR stated in an April 2014 report.

The borders are also a job creator. The more steps in the process, the more people Kabul must employee to oversee imports. Unfortunately, these jobs “[provide] an additional avenue for corruption,” the SIGAR letter stated.

Corrupt border officials taking bribes conjures images of drugs and weapons, but Afghanistan’s borders are typically far more banal. Wheat and rice are two of the most common smuggled items.

Criminal networks often steal food outside of the country, then move it into Afghanistan. They misrepresent the goods on the import forms, bribe the border agents and then sell the food on Afghan markets.

The smugglers threaten Afghan guards who won’t take a payout. If the threats don’t work, they kidnap them and ensure they’re willing to take some dirty money. The problem is so bad that American officials can’t keep up … and it’s getting worse.

The Department of Homeland Security’s Border Management Task Force in Afghanistan has helped Kabul regulate its borders for years. The task force trained Afghan border guards, simplified the import system and made sure goods proceeded legally and importers paid custom duties.

“When there is a U.S. presence at the [Afghan] border, the BMTF mentors are able to provide additional oversight and advisory services to Afghan officials, which helps to stem corrupt activities,” SIGAR noted in its April report.

“When BMTF officials are not physically present at border crossings, corrupt and criminal activities often resume.”

America is largely leaving Afghanistan, and the task force pulled out in November. And the process that once made up close to half Kabul’s budget now accounts for about 30 percent. This year, revenue from imports is due to be the lowest in four years.

It’s not that less stuff is coming into the country—officials can just now more easily pinch people’s pockets. The old task force isn’t watching, and most Afghan border guards aren’t interested in enforcing anti-corruption policies.

Economists at the U.S. embassy in Afghanistan believe that Kabul coulddouble revenue from imports if it cracks down on border graft. If not, Washington will pick up the tab for the budget shortfall.

“If a sizeable portion of the Afghan government’s total annual domestic revenue collections is being stolen,” SIGAR wrote in its letter to the U.S. Ambassador in Afghanistan. “It is a major problem given the government’s projected budget deficits.”

America may be leaving Afghanistan, but that doesn’t mean it will stoppaying for Afghanistan.