The Obama administration has run out of patience with Iraq’s Army. On Sunday, Secretary of Defense Ashton Carter appeared on CNN’s “State of the Union” to discuss the recent fall of Ramadi, one of Iraq’s major cities, to ISIS. Despite possessing substantial advantages in both numbers and equipment, he said, the Iraqi military was unable to prevent ISIS forces from capturing the city.

“That says to me and, I think, to most of us, that we have an issue with the will of the Iraqis to fight ISIL and defend themselves.”

Carter’s frustrations are shared by his boss. When asked about the war against ISIS in a recent interview with The Atlantic’s Jeffrey Goldberg, President Obama said that “if the Iraqis are not willing to fight for the security of their country, then we cannot do it for them.”

It’s easy to see why Washington is unhappy with Baghdad. In the eight years the U.S. formally occupied Iraq, the U.S. invested $25 billion in training and equipping the country’s armed forces before withdrawing in 2011. To this day, a much smaller number of American soldiers remain in the country in order to train Iraqi soldiers.

Despite these efforts, the Iraqi military is in pretty bad shape. Given the prevalence of desertion, it’s impossible to say with any reasonable certainty how many soldiers are actually serving—estimates vary from 50,000 to 140,000. Last summer, a group of several hundred ISIS fighters routed nearly 30,000 Iraqi troops tasked with defending Mosul, the country’s second-largest city, as many soldiers abandoned their uniforms and melted back into the population. Even the military’s few success stories come with major caveats. Tikrit, which Iraqi troops recaptured from ISIS in March, remains completely empty three months later.

What accounts for the Iraqi military’s failure? Many problems stem from the Bush administration’s decision to disband the existing Iraqi military in 2003 and build a new one from scratch. Intended to rid the institution of officers linked to Saddam Hussein, the move instead left thousands of armed men unemployed and embittered. This contributed to a security vacuum within Iraqi society and fed a vicious anti-U.S. insurgency. Many high-ranking officials who served under Saddam have now become senior commanders with ISIS.

The Iraqi army is also notoriously corrupt, a legacy of Nouri al-Maliki’s years as prime minister. Fearful that a strong military would pose a threat to his power, al-Maliki replaced top commanders with political clients drawn from his Shiite sect, undermining any attempt to establish a merit-based system of promotion. So-called “ghost battalions” draw salaries despite never reporting for duty, and the forces who do remain are no match for fanatical ISIS fighters. “Military training, no matter how intensive, and weaponry, no matter how sophisticated and powerful, is no substitute for belief in a cause,” William Astore, a former U.S. Air Force lieutenant colonel, wrote last year in the American Conservative.

But the main problem with the Iraqi military is the problem with Iraq as a whole—the country effectively no longer exists as a unified state. Kurdistan, for all intents and purposes, acts as an independent country. Much of the Sunni population lives in territories controlled by ISIS. The rump Iraqi government, meanwhile, operates in close cooperation with Iran, which funds Shiite militias that act as a paramilitary force. The Iraqi military, then, is less a cause of the country’s failures than a reflection of them.

In response to the persistent ISIS threat, some senators—including the famously hawkish John McCain—have advocated redeploying American ground troops in Iraq. President Obama has resisted this move, telling Goldberg that instead the U.S. should seek “effective partners” within the Iraqi government to help secure the country’s territory. But absent more fundamental changes in Iraq’s political situation, it’s hard to see its military gathering the “will to fight” that Carter believes it lacks.

“One thing is clear,” wrote Astore, “the foreign armies that the U.S. invests so much money, time, and effort in training and equipping don’t act as if America’s enemies are their enemies.”