BAGHDAD — One Iraqi general is known as “chicken guy” because of his reputation for selling his soldiers’ poultry provisions. Another is “arak guy,” for his habit of enjoying that anise-flavored liquor on the job. A third is named after Iraq’s 10,000-dinar bills, “General Deftar,” and is infamous for selling officer commissions.

They are just a few of the faces of the entrenched corruption of the Iraqi security forces, according to Iraqi officers and lawmakers as well as American officials.

The Iraqi military and police forces had been so thoroughly pillaged by their own corrupt leadership that they all but collapsed this spring in the face of the advancing militants of the Islamic State — despite roughly $25 billion worth of American training and equipment over the past 10 years and far more from the Iraqi treasury.

Now the pattern of corruption and patronage in the Iraqi government forces threatens to undermine a new American-led effort to drive out the extremists, even as President Obama is doubling to 3,000 the number of American troops in Iraq.