(Adds details of U.S. boosting embassy security, possible dialogue with Iran, paragraphs 6-7, 15-17)
* Fighting spreads to northwest town near Syria border
* Pictures appear to show ISIL fighters shooting dozens
* Nine killed in Baghdad suicide bombing
* Washington boosting security at Baghdad embassy
By Ziad al-Sanjary and Ahmed Rasheed
MOSUL/BAGHDAD, June 15 (Reuters) - Sunni insurgents seized a mainly ethnic Turkmen city in northwestern Iraq on Sunday after heavy fighting, solidifying their grip on the north after a lightning offensive that threatens to dismember Iraq.
Residents reached by telephone in the city of Tal Afar said it had fallen to the rebels from the Islamic State of Iraq and the Levant after a battle that saw heavy casualties on both sides.
"The city was overrun by militants. Severe fighting took place, and many people were killed. Shi'ite families have fled to the west and Sunni families have fled to the east," said a city official who asked not to be identified.
Tal Afar is a short drive west from Mosul, the north's main city, which the ISIL fighters seized last week at the start of a drive that has plunged the country into the worst crisis since U.S. troops withdrew.
The advance has alarmed Prime Minister Nuri al-Maliki's Shi'ite supporters in Iran as well as the United States, which helped bring Maliki to power after its 2003 invasion that toppled Sunni dictator Saddam Hussein.
Washington on Sunday ordered military personnel to boost security for its diplomatic staff in Baghdad and said some staff were being evacuated from the embassy as the Iraqi government battled to hold off insurgents.
The United States is also preparing to open a direct dialogue with longtime arch-foe Iran on the security situation in Iraq and ways to push back Sunni militants, the Wall Street Journal reported on Sunday.
Iran has held out the prospect of working with the United States to help restore security in Iraq.
Tal Afar had been defended by an unit of Iraq's security forces commanded by a Shi'ite major general, Abu Walid, whose men were among the few holdouts from the government's forces in the province around Mosul not to flee the rapid ISIL advance.
After sweeping through towns in the Tigris valley north of Baghdad, ISIL fighters appear to have halted their advance outside the capital, instead moving to tighten their grip on the north.
Most of the inhabitants of Tal Afar are members of the Turkmen ethnic group, who speak a Turkic language. Turkey has expressed concern about their security.
The Turkmen and other residents of Tal Afar are divided among Sunnis and Shi'ites in a part of Iraq with a complex ethnic and sectarian mixture. The city is just outside Iraq's autonomous Kurdish region, whose own security forces have taken advantage of the collapse of government control to advance into the city of Kirkuk and rural areas with oil deposits.
ISIL fighters aim to establish a caliphate on both sides of the Syria-Iraqi frontier based on strict medieval Sunni Muslim precepts. Their advance has been assisted by other Sunni Muslim armed groups.
U.S. President Barack Obama has said he is reviewing military options, short of sending troops, to combat the insurgency.
The Pentagon said in a statement that a small number of defense personal "are augmenting State Department security assets in Baghdad to help ensure the safety of our facilities."
A U.S. military official said fewer than 100 people would be involved, including Marines and other soldiers.
The vast mission is the largest and most expensive embassy ever built anywhere in the world, a vestige of the days when the United States had 170,000 troops in Iraq battling to put down a sectarian civil war that followed its invasion.
Iraq now faces the prospect of similarly vicious warfare, but this time with no U.S. forces on the ground to intervene. Its million-strong army, trained and armed by Washington at a cost of around $25 billion, has been plagued by corruption, poor morale and a perception it pursues Shi'ite sectarian interests.
Residents in Tal Afar said Shi'ite police and troops rocketed Sunni neighbourhoods before the ISIL forces moved in and finally captured the city. A member of Maliki's security committee told Reuters government forces had attacked ISIL positions on the outskirts of the city with helicopters.
"The situation is disastrous in Tal Afar. There is crazy fighting and most families are trapped inside houses, they can't leave town," a local official said on Sunday before the city was overrun. "If the fighting continues, a mass killing among civilians could result."
Shi'ites, who form the majority in Iraq and are based mainly in the south, have rallied to defend the country, with thousands of volunteers turning out to join the security forces after a mobilisation call by the top Shi'ite cleric. Maliki's security forces and allied militias regained some territory on Saturday.
In Baghdad on Sunday, a suicide attacker detonated explosives in a vest he was wearing, killing at least nine people and wounding 20 in a crowded street in the centre of the capital, police and medical sources said.
At least six people were killed, including three soldiers and three volunteers, when four mortars landed at a recruiting centre in Khalis, one of the last big towns in government hands north of the capital, 50 km (30 miles) north of Baghdad.
Volunteers were being gathered by the army to join fighting to regain control of the nearby town of Udhaim.
ISIL fought as al Qaeda's Iraq branch against U.S. forces during the years of American occupation in Iraq, but broke away from al Qaeda after joining the civil war in Syria. It now says the group founded by Osama bin Laden is not extreme enough.
In years of fighting on both sides of the frontier, ISIL has gained a reputation for shocking brutality. It considers Shi'ites to be heretics deserving of death and sends bombers daily to kill hundreds of Iraqi civilians each month.
A series of pictures distributed on a purported ISIL Twitter account appeared to show gunmen from the Islamist group shooting dozens of men, unarmed and lying prone on the ground.
Captions accompanying the pictures said they showed hundreds of army deserters who were captured as they tried to flee the fighting. They were shown being transported in the back of trucks and led to an open field where they were laid down in rows and shot by several masked gunmen. In several pictures, the black Islamist ISIL flag can be seen.
Most of the captured men were wearing civilian clothes, although one picture showed two men in military camouflage trousers, one of them half covered by a pair of ordinary trousers.
"This is the fate of the Shi'ites which Nuri brought to fight the Sunnis," a caption to one of the pictures reads. Others showed ISIL fighters apparently seizing facilities in Tikrit, Saddam Hussein's hometown, which they captured on Wednesday.
It was not immediately possible to verify the authenticity of the pictures.
Across the border, a Syrian government air raid hit near ISIL's headquarters in the eastern city of Raqqa, Syrian activists said.
The only Syrian provincial capital in insurgent hands, Raqqa has been a major base for ISIL since the group evicted rival rebels, including al Qaeda's Syrian affiliate, during infighting this year.
The Britain-based Syrian Observatory for Human Rights said warplanes targeted the governorate building, a large structure in the centre of town, as well as two other buildings, including a sharia, or Islamic law, court.
The fighting in Iraq is by far the worst since U.S. troops pulled out in 2011. U.S. President Barack Obama has come under fire at home for failing to do more to bolster Baghdad.
While expressing support for Maliki's government, the United States has stressed the need for a political solution to the crisis. Maliki's opponents accuse him of sidelining Sunnis, which fuelled resentment that fed the insurgency.
Secretary of State John Kerry told Iraq's foreign minister in a call on Saturday that U.S. assistance would only succeed if Iraqi leaders set aside their differences and forged the national unity needed to confront the insurgent threat.
The United States ordered an aircraft carrier moved into the Gulf on Saturday, readying it in case Washington decides to pursue a military option.
Oil prices have risen to the highest level this year over fears of the violence disrupting exports from the OPEC member. (Additional reporting by Isabel Coles and David Sheppard in Arbil, Raheem Salman in Baghdad, Alexander Dziadosz in Beirut, and Missy Ryan and Jim Loney in Washington; Writing by Peter Graff; Editing by Giles Elgood, Sonya Hepinstall and Eric Wa;sj)