* Bus was transporting prisoners to Baghdad when attacked

* Kurdish fighters regain northern town from militants

* Violence underscores need for power-sharing government

* Ban says Iraq facing "existential threat" (Adds Ban Ki-moon, scene of attack)

By Michael Georgy

BAGHDAD, July 24 (Reuters) - A shooting and bombing attack on a bus near Baghdad killed 52 prisoners and nine policemen on Thursday, Ministry of Justice sources said, as politicians faced pressure to form a power-sharing government that can tackle a Sunni insurgency.

The bus was transporting prisoners from a military base in the town of Taji to Baghdad when it was hit by roadside bombs, the sources said. Gunmen then opened fire. The attack left a burned shell of the vehicle along a rural road.

Much of Iraq's recent bloodshed is linked to sectarian divisions that have deepened since Sunni militants formerly known as the Islamic State of Iraq and the Levant (ISIL) seized large swathes of northern Iraq last month and declared an Islamic empire.

Sunni militants have been carrying out attacks around the southern edge of Baghdad while in response, Shi'ite militias have been active in rural districts of Baghdad, abducting Sunnis they suspect of militancy. Many later turn up dead.

The tit-for-tat attacks have escalated dramatically since the Sunni militant advance towards Baghdad, the most serious challenge to the Shi'ite-led government of Prime Minister Nuri al-Maliki since the withdrawal of U.S. forces in 2011.

Mass killings of scores of victims have become a regular occurrence in Iraq for the first time since the worst days of sectarian and ethnic cleansing in 2006-2007.

The motive for Thursday's killings was not immediately clear. In June, 69 prisoners were killed while being transported from an outlying town to a jail in Baghdad. The official account, given by the governor of Hilla, was that militants had attacked the convoy, killing 10 prisoners and one policeman.

But a police captain, a second police officer and a senior local official told Reuters no attack took place, and that police had killed the 69 men.

Graphic depicting territorial gains of the Islamic State militants: http://link.reuters.com/xan99v

"EXISTENTIAL THREAT"

In northern Iraq, Kurdish peshmerga fighters, who have for weeks been battling Islamic State militants in Jalawla, 115 km (70 miles) northeast of Baghdad, took complete control of the town after overnight clashes.

Jalawla lies in disputed territory, and is one of several towns where Iraqi troops and Kurdish peshmerga regional guards have previously faced off against each other, asserting their competing claims over the area.

In June, Kurdish forces took control of the northern oil city of Kirkuk after government troops abandoned their posts in the face of the Sunni Islamist rebel march towards Baghdad.

Kurds have long dreamed of taking Kirkuk and its huge oil reserves. They regard the city, just outside their autonomous region, as their historical capital.

Thursday's violence underscored the urgent need for Iraqi leaders to hold Iraq together as its future as a unified state is increasingly under threat from Sunni Islamist militants and the growing power of sectarian militias.

Iraq's million-strong army, trained and equipped by the United States, has largely collapsed, especially in the north after Islamists overran the city of Mosul last month.

Iraq's politicians have been in deadlock over forming a new government since an election in April.

Washington hopes a more inclusive government in Baghdad could save Iraq by persuading moderate Sunnis to turn against the insurgency, as many did during the "surge" offensive in 2006-7 when U.S. troops paid them to switch sides.

Maliki has ruled since the election in a caretaker capacity, defying demands from the Sunnis and Kurds that he step aside for a less polarising figure. Even some Shi'ite politicians want Maliki to go.

U.N. Secretary-General Ban Ki-moon said on Thursday he was "profoundly worried" about violence engulfing Iraq and urged politicians to bury their differences and form a power-sharing government.

"Iraq is facing an existential threat but it can be overcome through the formation of a thoroughly inclusive government -- a government that can address the concerns of all communities, including security, political, social and economic matters," he told a press conference with Maliki in Baghdad.

Iraq's parliament, which had been due to elect the country's president on Wednesday, postponed the vote by a day.

Under Iraq's governing system, in place since the post-Saddam Hussein constitution was adopted in 2005, the prime minister is a member of the Shi'ite majority, the speaker a Sunni and the largely ceremonial president a Kurd. (Additional reporting by Raheem Salman and Isra' al-Rubei'i; Editing by Raissa Kasolowsky)

Our Standards: The Thomson Reuters Trust Principles.