KABUL, Afghanistan — When U.S. forces and their Afghan allies rode into Kabul in November 2001 they were greeted as liberators. But after 17 years of war, the Taliban have retaken half the country, security is worse than it’s ever been, and many Afghans place the blame squarely on the Americans.

The United States has lost more than 2,400 soldiers in its longest war, and has spent more than $900 billion on everything from military operations to the construction of roads, bridges and power plants. Three U.S. presidents have pledged to bring peace to Afghanistan, either by adding or withdrawing troops, by engaging the Taliban or shunning them. Last year, the U.S. dropped the “mother of all bombs” on a cave complex.

None of it has worked. After years of frustration, Afghanistan is rife with conspiracy theories, including the idea that Americans didn’t stumble into a forever war, but planned one all along.

Mohammed Ismail Qasimyar, a member of Afghanistan’s High Peace Council, wonders how U.S. and NATO forces — which at their peak numbered 150,000 and fought alongside hundreds of thousands of Afghan troops, were unable to vanquish tens of thousands of Taliban.

“Either they did not want to or they could not do it,” he said. He now suspects the U.S. and its ally Pakistan deliberately sowed chaos in Afghanistan to justify the lingering presence of foreign forces — now numbering around 15,000 — in order to use the country as a listening post to monitor Iran, Russia and China.

“They have made a hell, not a paradise for us,” he said.

Afghanistan is rife with such conspiracy theories. After last month’s assassination of Kandahar’s powerful police chief, Gen. Abdul Raziq, social media exploded with pictures and posts suggesting he was the victim of a U.S. conspiracy. Recent insider attacks, in which Afghan forces have killed their erstwhile U.S. and NATO allies, have attracted online praise.

“In 2001 the Afghan people supported the arrival of the United States and the international community wholeheartedly,” said Hamid Karzai, who was installed as Afghanistan’s first president and twice won re-election, serving until 2014.

“For a number of years things worked perfectly well,” he said in a recent interview. “Then we saw the United States either changed course or simply neglected the views of the Afghan people and the conditions of the Afghans.”

He blames the lingering war on the U.S. failure to eliminate militant sanctuaries in neighboring Pakistan, the bombing of Afghan villages and homes, and the detention of Afghans.

Others blame the notoriously corrupt government, which Karzai headed for more than a decade, and which is widely seen as yet another bitter fruit of the American invasion.

“All the money that has come to this country has gone to the people in power. The poor people didn’t get anything,” said Hajji Akram, a day laborer in Kabul’s Old City who struggles to feed his family on around $4 a day. “The foreigners are not making things better. They should go.”

It’s not just Afghans. The United States’ own inspector general for Afghanistan’s reconstruction offered a critique in a speech earlier this month.

John Sopko pointed out that the U.S. has spent $132 billion on Afghanistan’s reconstruction — more than was spent on Western Europe after World War II. An additional $750 billion has been spent on U.S. military operations, and Washington has pledged $4 billion a year for Afghanistan’s security forces.

The result?

“Even after 17 years of U.S. and coalition effort and financial largesse, Afghanistan remains one of the poorest, least educated, and most corrupt countries in the world,” Sopko said. “It is also one of the most violent.”

Hamidullah Nasrat sells imported fabrics in the capital’s main bazaar on the banks of the Kabul River, a fetid trickle running through a garbage-filled trench. He remembers welcoming the overthrow of the Taliban, who had shut down his photography studio because it was deemed un-Islamic.

“After the Taliban we were expecting something good, but instead, day by day, it is getting worse,” he said. “How is it that a superpower like the United States cannot stop the Taliban? It is a question every Afghan is asking.”

The U.S. and NATO formally concluded their combat mission in 2014. Since then, the Taliban have carried out near-daily attacks on rural checkpoints and staged coordinated assaults on major cities. Authorities stopped publishing casualty figures earlier this year, deeming them classified. An Islamic State affiliate has meanwhile carried out massive bombings against the country’s Shiite minority.

Afghans who have recently served on the front lines complain of faulty equipment, inadequate supplies and reinforcements that show up late and ill-equipped, if at all.

Tameem Darvesh served in the Afghan army for nearly five years in the southern Helmand province. This year he went on holiday and never returned, trading his $180 monthly salary for work as a day laborer making much less. He said morale is at an all-time low, with many soldiers expressing sympathy for the Taliban.

Jawad Mohammadi served for more than seven years in the security forces until 2015, when he stepped on a land-mine he was tasked to clear and lost both his legs. He was just 25.

He recalls how the foreign instructors told him to always check his mine detector by waving it over a piece of metal before heading out into the field. But whenever a device failed to respond, his Afghan commander would tell him to use it anyway.

“I was told that’s all we have. That’s what we were given, you just have to use it,” he said.

The next time he went out with a faulty device, his foot found a bomb that the detector had missed.

“I felt myself being thrown through the air. I looked and I saw my legs were near me and there was so much blood. I yelled: ‘Please help me.’?”