SKHIRAT, Morocco (Reuters) - The United Nations proposed a national unity government to Libya’s warring factions on Thursday to end their conflict, but the deal faces resistance from Tripoli’s self-declared rulers and hardliners on the ground.

Damaged homes are seen after clashes between members of the Libyan pro-government forces, backed by the locals, and Shura Council of Libyan Revolutionaries, an alliance of former anti-Gaddafi rebels who have joined forces with Islamist group Ansar al-Sharia, in Benghazi, Libya July 7, 2015. REUTERS/Stringer

Libya is caught up in a war between the internationally recognized government and its elected parliament, and an unofficial government controlling Tripoli. Each side is backed by rival alliances of armed factions.

Four years after the fall of Muammar Gaddafi, Western powers are pushing for both sides to accept the U.N. accord, fearing violence has allowed Islamist militants to gain ground and illegal migrant smugglers to take advantage of the chaos.

Libya’s recognized government has operated out of the east of the country since last year when an armed faction called Libya Dawn took over Tripoli, set up its own government and reinstated a former parliament known as the GNC.

The U.N. proposal comes after months of protracted negotiations between delegates from both sides, who have faced pressure from hardliners and from continued fighting on the ground that has halted part of Libya’s oil production.

Delegates from Tripoli’s GNC parliament already balked at proposing candidates for the unity government because they wanted more amendments to the initial deal. But the U.N. proposal includes GNC members for the government.

“The GNC decided yesterday not to propose names and to ask for more changes in the text,” U.N. envoy Bernardino Leon told reporters in the Moroccan city of Skhirat, site of recent talks.

“The international community has been very clear that after huge efforts to adapt the text ... It is not possible to continue to do this.”

He said the door remained open for the GNC to participate in the proposed unity government. Both the elected House of Representatives and the GNC in Tripoli are expected to vote on the proposal.

U.N. Secretary-General Ban Ki-moon welcomed the proposal in a statement issued by his media office, while urging the parties to accept and sign the agreement.

The statement said Ban “urges Libyan leaders not to squander this opportunity to put the country back on the path to building a state that reflects the spirit and ambitions of the 2011 revolution”.

“Now is the time for the parties to the political dialogue to endorse this proposal and sign the agreement without delay,” Ban said in the statement.

The deal names six candidates for key posts in the national government. Fayez Seraj, a lawmaker from the elected House of Representatives, would be prime minister with three deputy prime ministers. Two senior members on a presidential council include a GNC member.

But the proposal faces problems on the ground, including the reaction of militant hardliners on both sides who still see the possibility of gaining more ground through fighting.

Questions also remain about the role in the armed forces of General Khalifa Haftar, a former Gaddafi ally who has become a divisive figure, and over the powers of the two legislative bodies under the national unity agreement.

Libya still has no official national army. Each side is backed by loose alliances of former anti-Gaddafi rebels, ex-soldiers, tribal factions and Islamist-leaning brigades, who once fought Gaddafi’s forces but have steadily turned against each other.