* Military base overrun and prisoners freed
* Attack deals major blow to Baghdad government
* City's capture follows days of fighting
The capture of the city of some two million by the Islamic State of Iraq and the Levant (ISIL), Sunni Muslims waging sectarian war on both sides of the nearby Iraqi-Syrian border, adds to its grip on key western cities and followed four days of heavy fighting in Mosul and surrounding Nineveh province.
The United States, which pulled out its troops two and a half years ago, pledged to help Iraq leaders "push back against this aggression" as the government of Prime Minister Nuri al-Maliki asked parliament to declare a state of emergency.
But the battle, for the time being, seemed to be over, with police discarding uniforms and weapons and fleeing a city where the black flag of ISIL was flying over government buildings.
"We have lost Mosul this morning," said a colonel at a local military command centre. "Army and police forces left their positions and ISIL terrorists are in full control.
"It's a total collapse of the security forces."
A Reuters reporter saw the bodies of soldiers and policemen, some mutilated, littering the streets.
"We can't beat them. We can't. They are well trained in street fighting and we're not. We need a whole army to drive them out of Mosul," one officer told Reuters. "They're like ghosts: they appear, strike and disappear in seconds."
The fall of Mosul, a largely Sunni Arab city after years of ethnic and sectarian fighting, deals a serious blow to Baghdad's efforts to fight Sunni militants who have regained ground and momentum in Iraq over the past year, taking Falluja and parts of Ramadi, in the desert west of Baghdad at the start of the year.
Control there, in Anbar province, as well as around Mosul in the north, would help ISIL and its allies consolidate control along the barely populated frontier with Syria, where they are fighting President Bashar al-Assad, an ally of Shi'ite Iran.
Thousands of families were fleeing north from Mosul, one of the great historic cities of the Middle East, towards the nearby Kurdistan region, where Iraq's ethnic Kurds enjoy autonomy.
"Mosul now is like hell. It's in flames and death is everywhere," said Amina Ibrahim, who was leaving with her children. Her husband had been killed last year, in a bombing.
In a statement, the U.S. State Department said it was "deeply concerned" and had senior officials in Baghdad and Washington monitoring events in coordination with the Iraqi government, Kurdish officials and other Iraqi figures. It said Washington would "support a strong, coordinated response".
"The United States will provide all appropriate assistance to the government of Iraq," it added, saying that its use of arms and fighters from Syria showed "ISIL is not only a threat to the stability of Iraq, but a threat to the entire region".
Police, military and security officials told Reuters the insurgents, armed with anti-aircraft weapons and rocket-propelled grenades, had taken over almost all police and army checkpoints in and around the city early on Tuesday.
Two army officers said security forces had received orders to quit Mosul after militants captured the Ghizlani army base and set more than 200 inmates free from a high-security prison.
Two police sources and a local government official said the militants had also broken into another jail called Badush, allowing more than 1,000 prisoners to escape. Most of these, they said, belonged to ISIL and al Qaeda. The army and police set fire to fuel and ammunition depots as they retreated to prevent the militants from using them, the officers said.
ISIL, led by Abu Bakr al-Baghdadi, broke with al Qaeda's international leader, Osama bin Laden's former lieutenant Ayman al-Zawahri, and has clashed with al Qaeda fighters in Syria.
ISIL posted photographs of its fighters wearing black balaclavas on its "Nineveh State" Twitter account, interspersed with verses from the Koran. The group dubbed the Mosul offensive "Enter Upon Them Through The Gates".
In a newsletter, ISIL enjoined Sunnis to join them in the fight against Maliki's "Safavid" army - a reference to the Persian dynasty that promoted Shi'ite Islam.
"Join the ranks oh brothers!" ran one slogan. "Maliki's tyrannical strength no match for pious believers."
Ibraheem al-Sumeide'i, a former adviser to Maliki who fell out with him over policy, said the prime minister should make way for a government of national unity: "The fall of Mosul into the hands of ISIL means that ISIL has unified the Iraqi and Syrian front and they have achieved their goal," he said.
Some Iraqi security sources estimate more than a thousand mainly Shi'ite troops have been killed and many more deserted from the army, as regular soldiers complain their leadership has not provided them with the equipment and training.
Maliki's critics blame him for leading Iraq to ruin by monopolising power and alienating the Sunni minority that long dominated Iraq until U.S. forces overthrew Saddam Hussein and oversaw elections that empowered the Shi'ite majority.
"EVEN THE DEAD SUFFER"
Militants also control the Qayara district near Mosul, where there is a military base and an airfield, security sources said.
In the neighbouring province of Salahaddin, they overran three villages in the Shirqat district, torching police stations, town halls and local council buildings before raising ISIL's banner. Over loudspeakers, insurgents said residents - and the police - would be safe if they remained in their homes.
On Monday, provincial governor Atheel Nujaifi made a televised plea to the people of Mosul to stand their ground and fight. Hours later, Nujaifi himself narrowly escaped the provincial headquarters in the city after militants besieged it.
Nujaifi's brother Osama, who is speaker of the parliament in Baghdad, called on the Kurdish leadership to sent their region's peshmerga forces to Mosul and wrest it back from "terrorists".
Kurdistan Prime Minister Nechirvan Barzani said his region had tried to coordinate with Iraqi federal authorities to protect Mosul, but Baghdad's stance had made it impossible.
Nearly 800 people were killed in violence across Iraq in May - the highest monthly death toll so far this year. Last year was the deadliest since the sectarian bloodletting of 2006-07.
At least 20 people were killed on Tuesday when two bombs exploded at a cemetery in the city of Baquba about 50 km (30 miles) northeast of Baghdad, as mourners buried a university professor shot dead the previous day, police and medics said.
"Mourners' bodies were flung among the graves by the force of the blasts," said Muhsin Farhan, a relative of the professor.
"Even the dead are suffering in Iraq."