Libyan Prime Minister Ali Zeidan said a "compromise" had been reached with ex-rebel militias who had given Libya's interim assembly a deadline to hand over power.
Powerful militias made up of former rebels from the western town of Zintan had given the General National Congress a late Tuesday deadline to quit, threatening to seize any lawmaker who ignored it.
Zeidan said the deadline had been extended by 72 hours but did not give further details of the compromise, saying only that "wisdom has prevailed" after discussions with representatives from the militias, the assembly and the UN.
The potential crisis arose exactly three years after the start of the Arab Spring uprising that toppled dictator Muammar Gaddafi but left the sprawling North African country with a weak central government.
The commanders of the Zintan militias had said they were giving the assembly five hours to "hand over power", pointing to a February 7 end of its mandate that it had extended. "Any member of Congress who stays will be ... a legitimate target and will be arrested, then judged," they said.
The ultimatum had triggered a meeting between the head of the UN mission to Libya, Tarek Metri, and the militias' commanders. "I asked them to give a chance to political dialogue on the basis of general elections being held," Metri said.
Libyans are set to vote today for a panel to draft a new constitution, but the polls have aroused none of the enthusiasm that attended its first free election in July 2012.