KARBALA, Iraq—The inner sanctum of the Imam Hussein Shrine shines day and night, illuminated by jeweled chandeliers. Their light is reflected in the mirrored domes of the roof, and gleams across the gold-framed marble walls. At the center of the shrine, a stream of pilgrims presses against the gilded grating that surrounds the sarcophagus of Hussein, grandson of the prophet Muhammad. In 680 AD, Imam Hussein was killed in the Battle of Karbala fighting the forces of the Umayyad caliph, his death cementing Sunni political dominance across the Islamic world. The battle was the point of no return in the schism between Sunni and Shia Islam, becoming the basis for the Shiites’ distinct rituals and identity, at the center of which is Hussein’s sacrifice.

Arbaeen, the pilgrimage to commemorate Imam Hussein’s death, sees devotees walk to Karbala from the Iraqi cities of Najaf and Basra, and even from Iran. It has more than doubled in size since 2008, growing to over 20 million people in 2015. “Imam Hussein fought against tyranny with his life,” Sheikh Maitham al-Zaidi, commander of the Abbas Division, a unit of Iraq’s Popular Mobilization Forces, explained to me on a visit to Iraq this fall. “As a symbol he inspires our men and they wish to give their souls to protect Iraq.” Owing to the ever-present threat of car bombs, only vehicles from the shrines or the police can enter the holy district in Karbala; so I traveled with officials from the shrine authorities.

With the growth of Arbaeen come donations and business opportunities that give the ayatollahs revenue to rival that of the provincial government. Half an hour’s drive from the Hussein Shrine, one of the three major Shia shrines in southern Iraq, is a camp housing around 7,500 internally displaced people (IDPs), who abandoned their homes ahead of ISIS’s devastating march through northwestern Iraq two years ago. For a time, the shrines and the government shared the cost of supporting the province’s 200,000 IDPs, as Nisayf Jasim al-Khattaby, the president of Karbala’s provincial council, explained. But the burden has shifted dramatically. Whereas in 2015 the government provided IDPs across the province with medical care, housing, and water sanitation, “this year we were dependent on the donations of wealthy families and businessmen to support the IDPs because of the fall in the oil price” and the costs of fighting ISIS, al-Khattaby said. “Their support [now] comes under the management of the shrines.”

To cover the shortfall in the government’s budget, the shrines drew on gifts from around the world, donations from the ever-rising number of pilgrims, and a vast investment portfolio. “We have houses, with fans and air conditioning in the summer, and heaters in the winter. We have food,” said Shihab Jassam Mohammed, who fled Fallujah in January 2014 with 11 members of his family. “All is supplied by the shrines.”

Today, Iraqi Shiites dominate the country’s political, social, and economic spheres—an indirect result of the U.S. invasion in 2003, which unseated the Sunni dictatorship of Saddam Hussein. Under Saddam, Shia clerics were suppressed, driven into exile, or imprisoned; in 1991, Saddam’s soldiers stormed and looted the Imam Hussein Shrine. As Shiites’ fortunes have risen, so, too, has the prominence of the three shrines.

Now, Shia clerics control the richest institutions in Iraq. Beyond supporting the region’s IDPs and running a vast network of charitable organizations, including schools, hospitals, and orphanages, the shrines have poured money into building infrastructure and investing in businesses. Shrine officials told me their printing presses produce the Iraqi Ministry of Education’s textbooks. A construction company, owned by the shrines, not only works on charitable projects, but paves roads and competes for contracts to build airports. In a concrete sense, the shrines have begun to assume the functions of the state.

Perhaps the clearest manifestation of the shrines’ ascendancy has been the formation of the Popular Mobilization Forces, a parallel army composed largely of Shia volunteers brought into the Iraqi military under a 2014 fatwa issued by 86-year-old Grand Ayatollah Ali al-Sistani, the senior-most cleric in Shia Islam. Although Sistani does not directly control all of the approximately 40 units that constitute the PMF, each of the three shrines sponsors and manages its own unit. The Abbas Division, currently battling the Islamic State, is one such unit. Its commanders told me that it boasts over 5,000 infantrymen trained by Iraq’s special forces, and is supported by engineers, a logistical corps, armored units with over 80 tanks, and a reserve of approximately 44,000 trained personnel.

How the shrines invest their money, and who they are perceived to support, has political consequences. That, in turn, is transforming how the ayatollahs understand their own role in Iraqi society. Under the leadership of Sistani and his predecessor, Grand Ayatollah al-Khoei, Iraq’s Shia clerics have, for decades, regarded themselves as moral counselors, offering guidance in private to those that seek it, while evading the direct glare of the political spotlight. But there is a growing popular call for them to take a stand against a faltering government perceived to be ineffective and endemically corrupt. “There is an increasing demand for the Grand Ayatollah to intervene,” said Abdul Rahman, an editor at the Shrine’s magazine Hussein Revivalism, “but they don’t understand the role of the Grand Ayatollah, which is guidance.”

Corruption is undoubtedly one of Iraq’s foremost challenges. Iraq was ranked 161 out of 168 countries in Transparency International’s 2015 Corruption Perceptions Index. From the pervasive culture of bribery, to nepotism in government contracts, to fake companies that allowed tax officials to siphon off over $250 million dollars in tax rebates, Iraq’s government is riddled with graft. Even the Iraqi security forces’ collapse to ISIS can, in part, be traced back to a series of scams in which commanders kept soldiers on the books that had been dismissed, and pocketed their salaries. Troops that existed on paper were nowhere to be found on the battlefield. Moreover, the prevailing belief that politicians continue to channel government contracts to their friends—a process that disproportionately benefits Shiites—both stoked resentment among Iraq’s Sunni minority before 2014, and will present a barrier to a political settlement after the expected liberation of the ISIS stronghold of Mosul.

The government’s response does little to instill confidence. “Parliament is subjected to problems as at the beginning for any other democracy,” said Ibrahim al-Jafaari, Iraq’s foreign minister, hardly doing justice to the seriousness of the problem. Al-Khattaby agreed that corruption remains a sizeable challenge for the Iraqi government, but feared that the way that it is portrayed will hamper efforts to stamp it out. “The media is covering for corrupt people and suggesting that society has been corrupted. This will create no trust in the government,” he said.

It is easy to see, then, why the shrines command such respect. Beyond their moral authority, they have proven to be effective. Mr. Hassan, who runs a mobile-phone shop in the bazaar near the Hussein Shrine, said that “we do not talk to the government. Government corruption raises prices throughout the economy. We talk to the shrines about our problems, and they listen.”

But Grand Ayatollah Sistani and his closest ally, Grand Ayatollah Sayid Mohammed Saeed al-Hakeem, say through spokesmen that they do not want to supplant the state. Instead, they want only to offer politicians private counsel on morality, as Sayid Riyadh al-Hakeem, Grand Ayatollah al-Hakeem’s son and spokesman, explained. “We suggest to military commanders that they prioritize their responsibility to protect civilians, but it is not for us to decide what weapons or tactics must be used on the battlefield,” al-Hakeem said. “Whatever decision is taken, it should be taken with the aim of protecting civilians.”

The issue of corruption, however, represents a unique challenge to this approach: In the eyes of many Iraqis, it is essentially a question of moral conduct, and not party politics. For this reason, many Iraqis like Dr. Zaid, a radiologist in Najaf, expect the shrines to take a stand. “Why, if Sistani can see the corruption, does he not speak out and say not to vote for bad people?” Dr. Zaid demanded to know. “One word from Sistani would change everything on the ground.”

Former Prime Minister Nouri al-Maliki’s fall from power in 2014 clearly demonstrated the influence of the clerical authorities. When it became apparent that he did not have Sistani’s confidence, he was forced to step down. But if the Shia clerics saw it as their role to publicly denounce ministers or laws they deemed inconsistent with sharia, it would present a serious challenge to Iraqi democracy. Such a move would make a political settlement with Iraq’s Sunni communities nearly impossible, for instance. And it could further antagonize Saudi Arabia, which views the encroachment of Shia power as an existential threat. The kingdom has already proven its willingness to push back against Shia revivalism in Yemen, where it is waging a war against Houthi rebels.

While Sistani has not gone as far in addressing corruption as Zaid would like, he has not been entirely silent. “Once the laws are not respected, corruption is spread on earth, and those who have violated the laws are cursed,” Sistani’s representative Sayid Ahmed al-Safi declared from the pulpit of the Imam Hussein Shrine on September 30, in a sermon written by the Grand Ayatollah that emphasized respect for the law among elected officials. “If there are no controls life will turn to anarchy. … If humans do not respect their laws they are worse than animals,” al-Safi said.

Not all of the clerical authorities share Sistani and al-Hakeem’s stated view that the ayatollahs should steer clear of politics. Grand Ayatollah Bashir al-Najafi advocates wilayat al-faqih, or “The Guardianship of the Jurist,” by which the cleric becomes the supreme legal authority. Iran’s clerics practice the most extreme form of wilayat al-faqih. There, the supreme religious authority, Ayatollah Khamenei, is also the head of state, with executive power. None of the Grand Ayatollahs in Najaf advocate such a system. But where Sistani, like his predecessor, sees the clerics’ pronouncements on legal matters as advisory, two of his potential successors believe the clerics should speak with legal authority. “Grand Ayatollah al-Najafi believes in this principle. Grand Ayatollah al-Fayadh is also sympathetic to the idea,” said Sheikh Ali al-Najafi, the son of, and spokesman for, Grand Ayatollah al-Najafi.

“We believe that Allah put sharia law in place to deal with society, and it is eternal. … The state’s law supplements Sharia law,” al-Najafi explained. “Sometimes sharia law and the law of the state conflict. Our duty is to make clear that this [state law] does not align with sharia.”

Which direction the clerics turn will be decided by Sistani’s successor, who will be chosen by the Shia community from among the other three Grand Ayatollahs in Najaf. The selection process is opaque and slow, but is aimed at establishing a consensus as to which Grand Ayatollah has the largest following and the recognition of his peers. Of Sistani’s potential successors, al-Hakeem is currently believed to have the greatest support. “Shia follow a living Ayatollah who can update our interpretation of the law and respond to modern challenges,” Sayid Saleh al-Hakeem, another son of Grand Ayatollah al-Hakeem, said.

With the defeat of ISIS on the horizon, it may be that Iraq’s future will be determined in theological debates in Najaf. Ironically, the institutions that have done the most to prop up the Iraqi state may, in an attempt to restore the moral integrity of the government, be its undoing.