* Military base overrun and prisoners freed
* Attack deals major blow to Baghdad government
* City's capture follows days of fighting
By Ziad al-Sinjary
MOSUL, Iraq, June 10 (Reuters) - Sunni Islamist insurgents seized control of Iraq's second largest city of Mosul early on Tuesday in a spectacular show of strength against the Shi'ite-led government, which called on parliament to declare a state of emergency.
The capture of Mosul by the Islamic State of Iraq and the Levant (ISIL) - an offshoot of al Qaeda - and its allies followed four days of fighting in the northern city and attacks in other towns.
Residents said ISIL black flags and banners were flying on captured government buildings.
The fall of Mosul deals a serious blow to Baghdad's efforts to fight Sunni militants who have regained ground and momentum in Iraq over the past year, pushing into Mosul last week and overrunning a military base and freeing hundreds of prisoners.
The army has been fighting ISIL in western Iraq since the start of the year when they overran two cities in the Sunni heartland of Anbar, which shares a border with Syria.
Across the frontier in Syria, ISIL fighters have seized territory close to the Iraqi border during three years of civil war between President Bashar al-Assad and rebels. ISIL militants from Iraq have joined the battle in Syria along with other foreign fighters with the aim of establishing a Sunni Islamist state on either side of the border.
In a speech on Tuesday, Iraqi Prime Minister Nuri al-Maliki urged the international community to support his country in its fight against "terrorism" and asked parliament to declare a state of emergency.
State television said the speaker of parliament had scheduled an emergency session for Thursday to vote on the motion, which requires a two thirds majority.
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 Mosul early on Tuesday.
"We have lost Mosul this morning. Army and police forces left their positions and ISIL terrorists are in full control," said an army colonel at the local military command. "It's a total collapse of the security forces."
Two army officers said security forces had received orders to leave Mosul after militants captured the Ghizlani army base and set more than 200 inmates free from a high-security prison.
A Reuters reporter saw policemen swapping their uniforms for plain clothes and discarding their weapons before fleeing the city. The bodies of soldiers and policemen, some of them mutilated, littered 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 said. "They're like ghosts: they appear to hit and disappear within seconds".
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, which they identified as belonging mostly to ISIL and al Qaeda.
The retreating army and police set fire to fuel and ammunition depots to prevent the militants from using them, the officers said.
University lecturer Zuhair al-Taie, who was trying to flee Mosul with his wife and three children, said ISIL's black banners were now flying over most army and government buildings. "The situation in Mosul is tragic," he said.
Ibraheem al Sumeide'i, a former advisor to Maliki who fell out with him over his policies, said the prime minister should step down so a national salvation government could be formed.
"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."
Some in Iraqi security estimate more than a thousand Shi'ite troops have been killed and thousands have deserted from the army, as regular Shi'ite soldiers complain their leadership has not provided them with the equipment and training.
Maliki's opponents blame him for leading the country to ruin. They say his refusal to share power has prevented the creation of a national unity government, allowed for a rise in Sunni militancy, and made him enemies among Shi'ite, Sunni and Kurdish leaders alike.
Thousands of families were fleeing north towards the autonomous Kurdistan region, which shares a border with Nineveh province, of which Mosul is the capital.
"Mosul now is like hell. It's up in flames and death is everywhere," said Amina Ibrahim, who was leaving with her children and said she had lost her husband in a bomb attack last year.
On Monday, 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 Mosul after militants besieged it.
Nujaifi's brother Osama, who is parliament speaker, called on the president of Iraqi Kurdistan to deploy the region's peshmerga forces to Mosul and wrest it back from "terrorists".
Kurdistan's 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 in turn was the deadliest year since sectarian bloodletting began to ease from its climax in 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 amongst the graves by the force of the blasts," said Muhsin Farhan, a relative of the professor. "Even the dead are suffering in Iraq". (Additional reporting by Ahmed Rasheed, Raheem Salman and Isra al-Rubei'i in Baghdad; Writing by Isabel Coles; Editing by Samia Nakhoul and Giles Elgood)
Our Standards: The Thomson Reuters Trust Principles.