Iraq's senior cleric on Friday urged political leaders to refrain from clinging to their posts - an apparent reference to Prime Minister Nuri al-Maliki, who has defied demands that he step aside.

Speaking through an aide who delivered a sermon after Friday prayers in the holy city of Kerbala, Grand Ayatollah Ali al-Sistani said leaders should show flexibility so that political deadlocks could be broken and Iraq could confront militants.

Last month, Sunni militants from the Islamic State of Iraq and the Levant swept through northern and western Iraq, posing the biggest challenge to Maliki's Shia-led government since the departure of U.S. forces in 2011.

Critics say Maliki is a divisive figure whose alienation of Sunnis has fueled sectarian hatred and played into the hands of the insurgents, who have threatened to march on Baghdad.

Sistani said it is time for politicians to think of Iraq's interests, not their own.

Mideast Iraq al Maliki Fate

In this Apr. 30, 2014 file photo, Iraqi Prime Minister Nouri al-Maliki prepares to cast his vote at a polling station. Since that election, he has ruled in a caretaker capacity, dismissing demands that he step aside for a less polarizing figure. (File/Associated Press)

"The sensitivity of this phase necessitates that all the parties concerned should have a spirit of national responsibility that requires the practice of the principle of sacrifice and self denial and not to cling to positions and posts."

Maliki, a Shia, has ruled since an election in April in a caretaker capacity, dismissing demands from the Sunnis and Kurds that he step aside for a less polarizing figure. Even some Shia oppose his bid for a third term.

Iraq's parliament elected senior Kurdish lawmaker Fouad Masoum as president on Thursday, a long-awaited step in creating a new government capable of countering the insurgency.

Maliki digs in

Politicians have been in deadlock over forming a new government since the election. The next step, choosing a prime minister, may prove far more difficult as Maliki digs in.

Sistani's call for flexibility could hasten his departure As he is seen as a voice of reason in the deeply divided country. A recluse who favours a behind-the-scenes role, he has called for Iraqis to take up arms against the Sunni insurgency.

The insurgents, who changed their name to the Islamic State and declared a caliphate in parts of Iraq and Syria, have put Iraq's survival as a unified state in jeopardy. The army virtually collapsed in the face of their lightning advance.

Sectarian militias and Kurdish peshmerga fighters have become a a critical line of defence against the Islamic State as the militants set their sights on the capital.

U.S. military and Iraqi security officials estimate the Islamic State has at least 3,000 fighters in Iraq, rising towards 20,000 when new recruits since last month's advance are included.

Stamping out non-Islamic influences

Aside from military campaigns, insurgents have been stamping out any religious or cultural influences they deem non-Islamic.

On Friday, the group warned women in the city of Mosul to wear full-face veils or risk severe punishment.

"The conditions imposed on her clothes and grooming was only to end the pretext of debauchery resulting from grooming and overdressing," said the Islamic State in a statement.

"This is not a restriction on her freedom but to prevent her from falling into humiliation and vulgarity or to be a theatre for the eyes of those who are looking."