TUZ KHURMATO, Iraq (Reuters) - In some places, the line dividing this town in northern Iraq takes the form of blast walls and barricades that bring its run-down streets to an abrupt end.
Elsewhere it is visible only to the people of Tuz Khurmato, who instinctively know where their own domain ends and hostile territory begins.
One side is controlled by Kurds, the other by Shi'ite Turkmen. They are waging a turf war in the town of more than 100,000 that risks dragging powerful armed groups into a bigger confrontation in the void left by the Iraqi state.
Tuz Khurmato offers a taste of what partition is like on the ground two years after Islamic State blitzed through Iraq, animating sectarian and ethnic rivalries and unleashing complex new power struggles that could further fracture the country.
The mayor -- a Kurd -- struggles to exercise his authority on the Turkmen side of the line and the police are weaker than the armed groups that patrol the streets.
"Unfortunately it has become two towns," said local Kurdish official Karim Shkur from his office inside a heavily fortified compound in Tuz Khurmato, about 175 km (108 miles) north of Baghdad.
There are houses for sale in almost every street on both sides because families are fleeing in fear of more violence. Young men with guns stand restless outside militia bases, and walls have been daubed with the words "there will be blood."
"Never has there been such enmity," said an older Shi'ite Turkman who says he lived in a mixed neighborhood until his house was burned down by Kurds during the first outbreak of hostilities last November.
He now lives in a majority Turkmen area. Kurds have moved out.
The main market where both groups used to do business is now under Turkmen control, so Kurds, who are too scared to go there, have opened a new strip of shops in their own part of town.
Mohammed Abbas, the head of the town municipality, said he had split his workers into groups so that they could clean the streets safely.
"We distribute them according to sect or ethnicity so we can reach all areas," he said. "We send the Kurd to the Kurdish areas and the Turkman to the Turkmen areas."
Turkmen teachers and pupils have left schools in the Kurdish zone, and vice versa. The main hospital is out of bounds for Kurds, and few dare venture to the courthouse or registry office because they are near a militia base and the Shi'ite endowment.
Friendships between Turkmen and Kurds have soured. Those who cross the line risk being insulted, assaulted, kidnapped or killed.
Earlier this month, seven Kurdish staff members at a medical center in a neighborhood dominated by Turkmen received a text message urging them to take down their flag and leave.
"We will fight you wherever you are, crush your heads beneath our feet and make you our slaves," read the message shown to Reuters and sent in the name of the Shi'ite Turkmen.
The line being forged through Tuz Khurmato is part of a longer contested frontier between the Baghdad government and the Kurds, who run their own region in the north.
In the decade that followed the U.S.-led invasion of Iraq, both sought to strengthen their claim over the town and the wider disputed territories in which it is located, co-opting or coercing local groups, and often pitting them against one other.
The game changed when Islamic State militants overran about one third of Iraq in 2014, taking towns and cities including Falluja west of Baghdad, and the army partially disintegrated, creating a power vacuum.
The Kurds took over large areas in the north, sending their peshmerga forces deep into disputed areas including Tuz Khurmato, which they defended against Islamic State.
Local Shi'ite Turkmen, however, were hostile to the prospect of being annexed to the autonomous region Kurds hope to convert into a state, and joined an array of militias under the newly formed banner of Hashid Shaabi (Popular Mobilisation), officially answerable to Baghdad.
"The Kurds claim Tuz Khurmato is part of the Kurdistan region and we believe it belongs to the central government of Iraq," said Haji Redha, the local commander of the Martyrs of Sadr militia. "We won't compromise on that."
Kurds suspect Turkmen efforts to control the town are part of a greater Shi'ite regional agenda to challenge their hold on the disputed oil city of Kirkuk, around 80 km (50 miles) north.
They put their differences aside to drive Islamic State further away from Tuz Khurmato together in late 2014, but then friction emerged between the multiple armed factions. The town became increasingly lawless, with kidnappings and killings targeting mainly Sunni Arabs, many of whom fled the town.
The fuse was lit in April when members of the Martyrs of Sadr militia threw a grenade into the base of a Kurdish peshmerga commander whose men responded with rocket propelled grenades, drawing other factions and armed locals into deadly street battles.
Some predict it is just the beginning of a bigger conflict to come between the Hashid Shaabi and the peshmerga once their common enemy, Islamic State, poses less of a threat.
With each round of hostilities, it becomes harder to reunite Tuz Khurmato, and the gap between the people fighting and those in charge grows wider.
The latest clashes were aborted by a deal between top Shi'ite and Kurdish commanders prodded by Iran, which is on good terms with both.
Despite their competing agendas, the main power brokers -- the Shi'ite Badr Organization and the Patriotic Union of Kurdistan (PUK) -- share an interest in maintaining stability.
But there are other factions on either side that stand to profit from confrontation by gaining status among locals who no longer believe in compromise.
"If Iran allowed us, we wouldn't let a single Kurd remain here," said Turkman Falah Hassan.
Peshmerga Kana Keter, 36, said the Kurds were not content for the conflict to stop now.
"This time, I don't think the people of the town will heed their own government," he said.
For now, the ceasefire is holding but several conditions of the agreement are proving too difficult to implement, and each side suspects the other of preparing for more fighting.
"Our governments in Baghdad or Erbil say we must live together like before, but it's not going to happen," said a Kurdish civilian who returned from Belgium to fight for his hometown. "There is blood between us and them".
Editing by Timothy Heritage