BAGHDAD — Iraq’s Prime Minister Nouri al-Maliki rejected an attempt by Iran to persuade him to step down, senior Iraqi politicians said Wednesday, underlining his determination to defy even his top ally to push for a third term in office and further exacerbating the country’s political crisis.

Al-Maliki has for weeks been resisting growing pressure for him to step aside, including from former Shiite political allies and from Iraq’s top Shiite spiritual authority. His critics see the Shiite prime minister as too divisive to form a government that can win support from the Sunni minority against the militant-led Sunni insurgency that has seized control of a large swath of the country.

But the recent meeting between al-Maliki and Iran’s pointman in Iraq, senior general Ghasem Soleimani, was the first sign that Iran also believed he should go. Iran was crucial for al-Maliki in winning a second term four years ago, when Tehran used leverage over Shiite parties to ensure their backing for him during grueling negotiations over a government at the time.

Al-Maliki’s rejection of the Iranian pressure puts Tehran in an unclear position, effectively posing it the choice of relenting to his remaining in the post or of hiking up pressure.

The two politicians told The Associated Press that Soleimani tried to persuade al-Maliki to drop his bid to stay in office during a recent meeting in Baghdad. Al-Maliki refused, arguing that his political bloc won the largest number of parliament seats in April elections, giving him the right to form the next government, said the politicians, both senior figures in Shiite factions. One of them attended the meeting and the other said he was briefed about it later.

The two said Soleimani was “taken aback” by al-Maliki’s refusal, but did not further elaborate. They spoke on condition of anonymity to discuss the closed-door meeting.

Neither the Iraqi or Iranian government has commented on Tehran’s role in mediating Baghdad’s political crisis.

Soleimani has taken a lead role in those efforts since the Sunni insurgency overwhelmed the northern city of Mosul last month and swept down toward Baghdad, plunging the country into its worst crisis since the withdrawal of U.S. troops in 2011.

According to Shiite officials, the general has been organizing Iraq’s military and Shiite militias to fight the insurgents while at the same time trying to organize Shiite factions on the formation of the next government. Soleimani is the head of the Quds Force, the external operations branch of Iran’s elite Revolutionary Guard.

The Islamic State group, the extremist force leading the insurgency, has vowed to continue its offensive on to Baghdad, although it appears to have crested for now after overrunning Iraq’s predominantly Sunni areas. But the country’s government has been unable to launch an effective counter-offensive against the militants.

The Islamic State group claimed responsibility for a suicide bombing in the capital late Tuesday that killed 31 people and injured 58 others as Shiites headed to a prominent shrine for prayers during the Islamic holy month of Ramadan. In a statement posted online, the group said the bombing was “in response to the hostility of the (Shiite-led) government.”

Iraq is under pressure to form an inclusive government that can draw Sunni support away from the insurgency. But many Sunnis are deeply alienated by al-Maliki, accusing him of sidelining them. Many of his Shiite and Kurdish allies have also grown disillusioned, saying he monopolizes power.

Last month, Iraq’s most revered and influential Shiite cleric, Grand Ayatollah Ali al-Sistani, appealed to al-Maliki through an intermediary to step aside because he fears al-Maliki is driving Iraq into fragmentation, according to a senior member of a prominent Shiite family that has for decades maintained regular contact with al-Sistani.

For weeks, lawmakers have been struggling to agree on a new government and on top leadership posts, with al-Maliki’s future the main sticking point.

After several delays, lawmakers elected a moderate Sunni as parliament speaker on July 15, the first step in the process.

A vote to select the next president is scheduled for Thursday, after Kurdish lawmakers requested a one-day delay. Under an informal arrangement in place since the 2003 ouster of Saddam Hussein, the presidency goes to a Kurd, the prime minister’s post to a Shiite and the speaker position to a Sunni.

The two senior political officials said Wednesday that al-Maliki favors Fuad Masoum, a close political ally and a member of outgoing President Jalal Talibani’s coalition, as the new president.

Two other names have also emerged as front-runners — former Deputy Prime Minister Barham Saleh and the Kirkuk provincial Gov. Najimaldin Karim.

On Wednesday, al-Maliki’s third-term ambitions received a boost by the Iraq’s Federal Supreme Court, which issued a decision requiring the new president to give the largest bloc in parliament — in this case, al-Maliki’s State of Law bloc — the task of forming a government and selecting a prime minister.

Al-Maliki’s State of Law bloc won 92 of parliament’s 328 seats in the election.