TRIPOLI // Abdelhakim Erassi came to Tripoli three months ago with a gun in his hand. Today he would rather be holding a book.
"My goal is to finish my studies and contribute something to my country," said Mr Erassi, 28, a militiaman from the mountain town of Zintan.
For now, however, Mr Erassi is among the out-of-town fighters that remain parked in Libya's capital, complicating efforts by an interim government to assert its authority.
While Mr Erassi considers himself a peacekeeper, militiamen also present a reminder of their home cities' muscle as leaders jockey for influence.
The government wants to replace the ad hoc militias that helped overthrow Muammar Qaddafi with a national army.
That means offering new possibilities to men such as Mr Erassi while winning support from local leaders empowered by the fight against Qaddafi's regime.
The revolutionary cradle of Benghazi has dominated post-Qaddafi politics, but ministerial appointments last month appeared to reflect a shifting balance of power.
Osama el Juweli, the head of Zintan's military council, was named defence minister days after Zintani militiamen captured Qaddafi's son, Saif Al Islam. The Misurata security chief Fawzi Abed Aal was named interior minister. Misurati fighters withstood a brutal assault by Qaddafi's forces and in August rolled into Tripoli to help topple him.
Such appointments should help the new government mediate among sometimes fractious cities and militias, said Hisham Karekshi, the deputy head of Tripoli's governing council.
"For example, the defence ministry is now under a man from Zintan, so it's easier for us to communicate," Mr Karekshi said.
Tripoli's leaders want out-of-town militiamen to go home or find new occupations.
"They have to give up their arms, get out of the camouflage clothes and the mode of war," said Mr Karekshi. "It's time to move from revolution to state."
While Libya has remained largely stable since Qaddafi's death in October, the calm has been marred by sporadic violence.
Gunfire erupted late on Sunday near Tripoli Central Hospital apparently between Tripoli gunmen and men from the mountain town of Rojban, said the hospital's security chief Abdelhafid Shtewi.
The gunfire killed one man and wounded two others, Mr Shtewi said. While all wore military garb, their possible affiliations and reasons for fighting were unclear.
Scores of Tripoli militiamen answered a distress call from the city's military council, said Abdelbast el Qantari, who commands 150 fighters from Abu Slim neighbourhood.
"When we have only Tripoli fighters in the city, we won't have these kinds of problems," Mr el Qantari said as militiamen armed with Kalashnikovs, sniper rifles and heavy machine-guns deployed outside the hospital.
The government intends to go further, phasing in national police to replace militia security forces, said Mr Abed Aal, the interior minister, in a press conference yesterday.
"So far, bloodshed between militias appears to have been motivated by local concerns and rivalries," said John Hamilton, a Libya expert at Cross-Border Information, a British risk assessment firm. "What we have to watch out for is any sign that armed groups are using their weapons to obtain political leverage."
For now, none has appeared.
But while many fighters who flooded Tripoli in August have disappeared, others remain.
Mr Erassi and six other Zintani fighters occupy a two-storey villa in Regatta, a beachside compound in Tripoli once peopled by foreign company employees.
One afternoon last week they were sitting on mattresses in the front room, smoking, drinking tea and watching TV. A Kalashnikov lay on the dining table.
"I was the first one who said no to Qaddafi," Mr Erassi said triumphantly when asked when he took up arms.
"And the first to burn the Zintan police station!" joked his fellow fighter, Ahmed Kamoun, 20.
Both statements were exaggerations, Mr Erassi admitted with a smile. But he had joined a local militia just a fortnight after revolt broke out in February.
Gradually, fighters from Zintan and other cities in the western Nafusah Mountains forced pro-Qaddafi troops down to the coastal plain.
One day near Zintan, Mr Erassi nearly died in machine-gun fire from a pro-Qaddafi soldier hidden in an olive tree. Mr Erassi remembers the tree quivering and his friends Ali and Mohammed riddled with bullets.
In August he joined one of Zintan's strongest militias, headed by commander Mohamed Madani. Soon they settled in Regatta.
The complex of peach-stucco houses and bungalows slopes to the sea, where Qaddafi family members kept holiday homes.
Today about 50 Zintani fighters under Mr Madani remain.
Without salaries, the men choose to remain in Tripoli "to help protect the country", said Mr Erassi.
"And frankly, life in the capital is better," he said. "The mountain region is hard. It's dry. There's no work."
For Mr Karekshi, from Tripoli's governing council, such complaints highlight the need to create alternatives for idle young militiamen.
"They can go into law enforcement or the national army, or back to old jobs if they had them," he said. "Otherwise we need to support job creation and give people training for skilled work."
Zintan militia leaders including Mr Madani could not be reached for comment.
Misurata has given its estimated 700 to 800 militiamen still afield until mid-December to come home, said Meftah Shetwan, a member of the city's governing council.
Misurata is simultaneously working to consolidate its militias to help convince fighters to surrender their weapons, Mr Shetwan said. "Then if the defence minister decides something, we'll go with it."
A former mechanic despite earning a law degree in 2008, Mr Erassi hopes to undertake a master's programme at Janzour's Academy of Graduate Studies if it reopens.
"I've also asked the foreign ministry for a job," he said. "We have a new system now. We'll see what it brings us."