* Move will further hamper legislation, move to democracy
* Islamist JCP had sought no confidence vote
* Clashes west of Tripoli with army, militias
* Constitution committee vote seen next month (Adds more details, context)
By Ghaith Shennib and Ayman Salha
TRIPOLI, Jan 21 Libya's Islamist Justice and Construction Party on Tuesday pulled its five ministers, including the oil minister, out of Prime Minister Ali Zeidan's government, complicating efforts to stabilize the OPEC country.
Two years after Muammar Gaddafi's fall, the oil-producing North African state has struggled to overcome political turmoil and heavily-armed ex-rebels who fought in the 2011 revolt against the autocrat but now refuse to disarm.
At least two people were killed in clashes on Tuesday west of Tripoli when soldiers and militia allies attacked an area where they said gunmen still loyal to Gaddafi were holed up, a Reuters witness and officials said.
Resignations by JCP, which had repeatedly failed to secure a vote of no-confidence against Zeidan, will deepen deadlock in the General National Congress (GNC) parliament, which has made little progress in Libya's transition to democracy.
"Zeidan failed in his duty to provide security, and to deliver in the electricity and oil sectors," Nizar Kawan, a leading JCP member, said in a statement.
"We had asked for a withdrawal of confidence, but some don't understand the danger of the stage we are at now."
Oil Minister Abdelbari Arusi was among those the JCP said was resigning.
Zeidan, a Liberal not linked to any major political bloc, had announced earlier this month that he planned to replace some ministers in a cabinet reshuffle meant to stave off criticism of his government's performance.
He has survived several attempts in the GNC to drum up support for a no-confidence vote.
The GNC is caught in a stalemate between the JCP, the political wing of the Muslim Brotherhood, and the leading parliamentary party, National Forces Alliance, a more nationalist coalition.
Since the GNC was elected more than a year ago, infighting has delayed legislation, and Libya still has no constitution. Elections are expected next month to choose a 60-member committee to draft the new constitution.
Tuesday's clashes broke out after soldiers backed by militia fighters loosely aligned with the government stormed the Warshafena area on the western outskirts of Tripoli to capture gunmen they accused of belonging to pro-Gaddafi forces.
At least two people were killed when troops and militiamen fired anti-aircraft guns and rockets into the area where they had said tribal fighters resisted with small rockets, a Reuters witness and hospital officials said.
The fighting was the heaviest since rival former rebels and militiamen withdrew from their bases in the Libyan capital late last year when street clashes killed dozens of protesters demanding militias pull out of the city.
Controlling former fighters and tribal demands is a major challenge for the central government. One former rebel commander has seized eastern oil ports with his armed militia, holding them since August and choking off oil shipments, to demand more regional autonomy.
Zeidan's government managed to restart production in the south and west, bringing oil output up to 600,000 barrels per day. (Reporting by Ghaith Shennib, Feras Bosalum and Ayman Salha; writing by Patrick Markey; Editing by Janet Lawrence)