TRIPOLI (Reuters) - Libya’s supreme court blocked legal challenges from lower courts to a draft constitution on Wednesday, paving the way for a possible referendum on the document and a move toward elections, a lawyer who helped draft the text said.

Establishing a constitutional framework is widely seen as a key step in efforts to stabilize Libya after years of anarchy following a 2011 uprising.

The oil-rich country has splintered in recent years into local fiefdoms, with competing parliaments and governments set up in the east and west of the country backed by rival armed alliances. The United Nations is hoping that elections can be held by the end of the year.

Members of a Constitutional Drafting Assembly (CDA) had voted last summer in favor of a draft constitution, but an administrative court in the eastern city of Bayda had ruled that the vote was invalid.

The supreme court effectively quashed the Bayda decision by declaring that administrative courts do not have the jurisdiction to rule on matters relating to the CDA, said Omar Naas, a CDA member.

The draft constitution could still face hurdles, including challenges in the supreme court, turnout or approval requirements set by the eastern parliament or House of Representatives (HOR) for a constitutional referendum, and the difficulty of holding a nationwide poll in a country where there are no national security forces.

Some of Libya’s minorities have also said they were excluded from a lengthy and sometimes acrimonious drafting process.

But Naas said the text was for “all Libyans”, and greeted the supreme court’s decision as “historic”.

“The next steps are for the House of Representatives to discuss and write the referendum law that will enable Libyans to decide their fate,” he said.