A defiant Nuri al-Maliki went on state television on the stroke of midnight to announce he was challenging President Fuad Masum in court for failing to nominate him as prime minister.

The move drew a sharp warning from United States for Maliki not to worsen the chaos caused by a two-month-old jihadist offensive that has brought Iraq to the brink of breakup.

But Iraq's federal court, the same that lifted the two-term cap for Maliki last year, swiftly ruled in his favour again.

"The federal court announces its decision confirming that State of Law is the largest bloc in parliament," Iraqiya TV reported.

A constitutional tussle on how to define the largest bloc in parliament had been the main technical obstacle in Maliki's way since his coalition's comfortable electoral victory in April.

It remained unclear however whether Masum would comply and hand Maliki a chance to form a government or whether the president would explore other options.

Speaking before the court decision was announced, US Secretary of State John Kerry gave Masum his unequivocal support and said, "Our hope is that Maliki will not stir those waters."

It had been thought Maliki was simply trying to gain leverage to impose his preferred replacement but the court ruling suggested the 64-year-old was prepared to go all the way to save his job.

Moments before he spoke on television, special forces, soldiers and police deployed across Baghdad, especially around the Green Zone district housing the country's key institutions.

Several of the capital's main thoroughfares and bridges were closed to traffic and today morning unusual numbers of security personnel, uniformed and plain-clothed, remained deployed across the city.

In his brief address, Maliki said Iraq was facing a "dangerous" situation and urged "the sons of Iraq" to be on alert.

Observers argue that Maliki is too isolated to remain in power by force but security officials told AFP the security set-up was akin to state of emergency measures.

Maliki had pledged in a 2011 AFP interview he would not seek a third term but he has since changed his mind despite losing the support of nearly all his erstwhile allies: United States, Iran, Shiite clerics and even his Dawa party.

Latest News from India News Desk