BAGHDAD | Islamic militants overran much of Iraq’s second-largest city of Mosul on Tuesday, seizing the governor’s headquarters and rampaging through police stations, military bases and the airport as security forces collapsed and abandoned their posts. Gunmen cruised through neighborhoods, waving black banners while residents fled.

A Kurdish policeman stands guard while refugees fleeing Mosul head to the self-ruled northern Kurdish region in Irbil, Iraq, 350 kilometers (217 miles) north of Baghdad, Tuesday, June 10, 2014. (AP Photo)
A Kurdish policeman stands guard while refugees fleeing Mosul head to the self-ruled northern Kurdish region in Irbil, Iraq, 350 kilometers (217 miles) north of Baghdad, Tuesday, June 10, 2014. (AP Photo)

The assault was a heavy defeat for Prime Minister Nouri al-Maliki in the face of a widening insurgency by a breakaway al-Qaida group, the Islamic State of Iraq and the Levant. The group has been advancing in both Iraq and neighboring Syria, capturing territory in what appears to be a campaign to set up a militant enclave straddling the border.

Earlier this year, Islamic State took control another Iraqi city, Fallujah, in the west of the country, and government forces have been unable to take it back. The far larger Mosul is an even more strategic prize. The city and surrounding Ninevah province are a major export route for Iraqi oil and a gateway to Syria.

In a sign of the weight of the blow, al-Maliki pressed parliament to declare a state of emergency that would grant him greater power, saying the public and government must unite “to confront this vicious attack, which will spare no Iraqi.” The parliament speaker called the rout a “disaster by any standard.”

Regaining Mosul poses a daunting challenge for the Shiite prime minister. The city has a Sunni Muslim majority and many in the community are already deeply embittered against his Shiite-led government. During the nearly nine-year American presence in the country, Mosul was a major stronghold for al-Qaida and U.S. and Iraqi forces carried out repeated offensives there, regaining a semblance of control but never routing the insurgents entirely.

But even when al-Qaida was strong in Mosul in the past, it never succeeded in outright driving government forces out. Insurgents and Iraqi troops have been fighting for days in the city, but Monday night and into early Tuesday, the security forces’ hold appeared to collapse.

Insurgents overran the Ninevah provincial government building in the city — a key symbol of state control — in the evening, and the governor fled the city. The fighters stormed police stations, bases and prisons, capturing weapons and freeing prisoners. Security forces melted away, abandoning many of their posts, and militant seized large caches of weapons.

They took control of the city’s airport and captured helicopters there, as well as a military airbase 60 kilometers (40 miles) south of the city, the parliament speaker said.

On Tuesday, the militants appeared to hold much of the eastern half of Mosul, which is bisected by the Tigris River. Mosul residents said fighters were raising the black banners that are the emblem of the Islamic State.

Online footage taken from a car driving through the streets of Mosul showed burning vehicles in the streets, black-masked gunmen in pickup trucks mounted with anti-aircraft guns, and residents walking with suitcases — apparently fleeing. The video appeared authentic and matched AP reporting of the events.

A government employee who lives about a mile from the provincial headquarters, Umm Karam, said she left with her family Tuesday morning.

“The situation is chaotic inside the city and there is nobody to help us,” she said “We are afraid … There is no police or army in Mosul.” She spoke on condition she be identified by a nickname for fear of her safety.

The assault in Mosul is also a sign of Iraq’s reversals since American forces left the country in late 2011. The Islamic State has ramped up its insurgency the past two years, presenting itself as the Sunni community’s champion against al-Maliki’s Shiite-led government

The group was once al-Qaida’s branch in Iraq, but under its leader Abu Bakr al-Baghdadi it has escalated its ambitions, sending fighters into Syria to join the rebellion against President Bashar Assad. Its jihadists became notorious as some of the most ruthless fighters in the rebellion — and other rebels turned against it, accusing it of trying to hijack the movement. Al-Qaida’ central command, angered over its intervention in Syria, threw the group out of the terror network.

But it has been making gains on both sides of the border. In Syria, it took control of an eastern provincial capital, Raqqa, and in the past month it has launched an offensive working its way toward the Iraqi border.

In Iraq, the group rose up earlier this year to take over Fallujah and parts of the nearby city of Ramadi, the capital of Anbar province. It has also been carrying out a campaign of bombings and other violence in Baghdad and other parts of the country.

The Mosul crisis comes as al-Maliki is working to put together a new governing coalition after elections last month, and is relying even more on Shiite parties. Sunnis and Kurds have grown increasingly disillusioned with al-Maliki, accusing him of dominating power.

The autonomous Kurdish region in the north has its own armed forces — the peshmerga — and on Tuesday, the region’s prime minister suggested his willingness to intervene beyond the formal borders of the self-rule enclave. That could be politically explosive, since the Mosul region lies on Kurdistan’s doorstep, has a significant Kurdish population, and the Kurds claim parts of the area as part of the autonomous region.

Kurdistan’s prime minister, Nechirvan Barzani, sharply criticized Baghdad’s handling of the Mosul crisis, saying the Kurds had tried unsuccessfully to work with the Iraqi security forces to protect the city.

“Tragically, Baghdad adopted a position which has prevented the establishment of this cooperation,” he said in a statement.

He urged the Kurds to aid those displaced from Mosul and said the peshmerga are prepared to handle security situation in areas outside the regional government’s jurisdiction — presumably referring to areas around Mosul inhabited by Kurds that are disputed with the central government.

State TV said parliament would convene Thursday to vote on a 30-day state of emergency, which requires passage by a two-thirds vote. The declaration would give al-Maliki the “necessary powers” to run the country — something legal experts said could include powers to impose curfews, restrict public movements and censor the media.

“What happened is a disaster by any standard,” parliament speaker Osama al-Nujaifi — a Sunni from Mosul — said in a televised address. “The presence of these terrorist groups in this vast province … threatens not just the security and the unity of Iraq, but the whole Middle East,” he said.