The campaign of Islamization intensified further after Iraq’s devastating defeat in Kuwait in 1991 and the subsequent Shiite revolt, culminating in 1993 with Mr. Hussein’s abandonment of the last vestiges of Baath secularism when he initiated the Faith Campaign. In some respects, Mr. Hussein’s government was following rather than leading public opinion, as Iraqis fell back on their faith for solace under the harsh international sanctions. But what began as a cynical attempt to shore up support, as the regime retreated to its Sunni tribal base, took on a life of its own, transforming Iraq into an Islamist state and imposing lasting changes on Iraqi society.

The government imposed a version of Shariah law: Thieves had their hands cut off, homosexuals were thrown from rooftops and prostitutes were beheaded in public squares. Numerous mosques were built, Quran study became a national focus and midlevel clerics acquired new roles as community leaders.

The Faith Campaign claimed to be ecumenical, but its clear pro-Sunni tilt led to a final collapse of relations between the state and the Shiite population and heightened sectarian tensions. In the Sunni areas, however, the campaign was effective, creating a religious movement I call Baathi-Salafism, under Mr. Hussein’s leadership. It also eased strains between the regime and independent religious movements like the “pure” Salafists, whose long opposition to the regime gave way to some of its members serving in its administration, even though Mr. Hussein was warned by his intelligence chief that if the alliance continued, the Salafists would eventually supplant the regime.

Alongside the Faith Campaign, Mr. Hussein’s regime constructed a system of cross-border smuggling networks designed to evade the sanctions. This funded a system of patronage, much of it distributed through mosques, that maintained a series of militias directly loyal to the ruler, like the Fedayeen Saddam and the Sunni tribes, as a hedge against any repeat of the 1991 Shiite revolt. These networks, which are deeply entrenched in the local populations, especially the tribes of western Iraq, are now run by the Islamic State, adding to the difficulty of uprooting the “caliphate.”

One of the less advertised aspects of the Faith Campaign was the infiltration of mosques by military intelligence officers. There was a trapdoor in this policy: With Baathism a spent force by the late 1990s, many of them slid into Salafism. The security sector had been profoundly influenced by Salafism by the time Mr. Hussein’s government fell.