BAGHDAD (AP) - Nouri al-Maliki's decision to step down as Iraq's prime minister raised hopes Friday for a new government that can roll back an increasingly powerful Sunni insurgency and prevent the country from splitting apart.
But to do that his successor has to unify Shiite, Sunni and Kurdish factions that deeply distrust each other and have conflicting demands, all while dealing with a humanitarian crisis and the extremists' continuing rampage in the north.
The man tapped to become the next prime minister, Haider al-Abadi, a veteran Shiite lawmaker, faces the immense challenge of trying to unite Iraqi politicians as he cobbles together a Cabinet in just over three weeks.
Al-Abadi said Friday his government will be based on "efficiency and integrity, to salvage the country from security, political and economic problems" - but that is easier said than done in a country where forming a government often falls victim to roadblocks and infighting.
Sunni politicians are pressing for greater political influence, saying their disenfranchisement under al-Maliki's Shiite-dominated government fueled support among the Sunni minority for the insurgency, led by the extremist Islamic State group. At the same time, the military needs significant bolstering after falling apart in the face of the militants' advance and proving incapable of taking back lost territory.
"Sunnis and Kurds were present in the Maliki government, but rarely included in the key decision-making process," said retired Brig. Gen. Mark Kimmett, former military spokesman for coalition forces in Iraq. "One hopes that al-Abadi understands that inclusion has to be more than mere participation."
Many Iraqis expressed a sense of relief Friday that al-Maliki had relented after weeks of insisting on a third four-year term, fueling a political crisis that raised fears of a coup in a country with a long history of violent power grabs.
During Friday prayers in Baghdad's Shiite Sadr City district, a man distributed sweets to Shiite worshippers, proclaiming, "Saddam has been brought down."
The comparison of al-Maliki to the late dictator Saddam Hussein showed the depth of opposition to the outgoing prime minister even among some of his fellow Shiites. Sadr City is dominated by followers of powerful Shiite cleric Muqtada al-Sadr, one of al-Maliki's harshest critics. Six years ago, al-Maliki sent security forces to battle al-Sadr's militias to establish his authority and project his image as a national leader.
"We congratulate the Iraqi people for the victory that has been done this week. It is the week of congratulations," said Ali Talaqani, a preacher loyal to al-Sadr, in his sermon to Sadr City worshippers.
Shiite factions turned against al-Maliki largely because they saw him as a domineering leader who monopolized power and allowed widespread corruption. Critics say he staffed the military's officer corps with incompetent loyalists, playing a major role in the army's collapse in the face of the Islamic State militants over the past two months.
Sunni factions also accused him of widespread corruption. But their principle grievance was that his government sidelined their community, carrying out sweeping arrest raids and violently dispersing protests.
"We are ready to cooperate with al-Abadi to make him succeed in his mission on the condition that the demands of our Sunni people are met," Ahmed al-Misari, a Sunni lawmaker, told The Associated Press.
"Our demands include stopping the army shelling of Sunni cities, releasing detainees, abolishing anti-terrorism laws, ending discrimination against our people and letting the people of Sunni provinces handle the security in their areas."
The Kurds, meanwhile, had been locked in a dispute with Baghdad over oil revenues from their largely autonomous region in the north, which prompted Baghdad to slash the annual budget to the region earlier this year, stoking calls by the ethnic minority for independence.
The advance of the Islamic militants toward the Kurdish regional capital Irbil forced the two governments to set their differences aside, but the longstanding conflicts over land and oil remain.
"Issues between Irbil and Baghdad over oil revenues haven't disappeared - they're just in the background for now," said Austin Long, a member of the Arnold A. Saltzman Institute of War and Peace Studies at Columbia University.
"Government formation has never been easy in Iraq," he added. "Al-Abadi has to consider that Irbil maybe wants some things that Baghdad may not be ready to give."
Iraq's most revered Shiite cleric, Ayatollah Ali al-Sistani, said in a Friday sermon delivered by his spokesman that there is a "dire need" for new leadership that can combat terrorism and heal sectarian divisions.
Al-Sistani, who rarely appears in public and almost always delivers messages through spokesmen, had been issuing veiled calls for al-Maliki to step aside for weeks, marking a rare intervention in politics by the quietist cleric.
Al-Maliki, who has been prime minister since 2006, announced late Thursday that he was stepping aside and threw his support behind al-Abadi, a fellow member of his Shiite Islamic Dawa Party.
The prime minister had been growing increasingly isolated as he struggled to keep his post. The United States, the U.N., and perhaps his most important ally Iran were in agreement that he should go.
The White House commended al-Maliki's move and expressed hope that the transfer of power "can set Iraq on a new path and unite its people" against the threat from Islamic militants, national security adviser Susan Rice said in a statement.
U.S. Secretary of State John Kerry said the move "sets the stage for a historic and peaceful transition of power in Iraq."
The U.N. Security Council urged al-Abadi to work swiftly to form "an inclusive government" that could address the country's challenges.
The Islamic State group's lightning advance since June has driven hundreds of thousands of people from their homes, and last week prompted the U.S. to launch aid operations and airstrikes as the militants threatened religious minorities and the Kurdish region.
The European Union's 28 foreign ministers at an emergency meeting in Brussels on Friday agreed to permit the delivery of arms and military equipment to the Kurds, provided it is done in concert with Iraq's central government.
France has pledged to ship weapons to the Kurds, while Britain is delivering ammunition and military supplies obtained from eastern European nations and is considering sending more weaponry. Germany, the Netherlands and others said they would also consider requests to arm the Kurds.