Disputed Libyan Prime Minister Ahmed Maiteg says he is stepping down to comply with a Supreme Court ruling that his election was unconstitutional.
Libya's parliament, where the chaotic vote took place last month, also said it would respect the Monday's ruling.
Since the vote in May, Libya has had two prime ministers as Abdullah al-Thani has not ceded power, says the BBC's Rana Jawad says in Tripoli.
Three years after Muammar Gaddafi was ousted Libya remains engulfed by chaos.
Mr Maiteg on Monday said he would be "the first" to comply with the rulings of the judiciary.
"I have God, the people and the nation as my witness that I respect the judiciary and comply with its ruling", he said.
His rival Mr Thani said he would step down in April following an attack on his family. However, he refused to recognise the election of Mr Maiteg because of the circumstances of the vote.
The parliamentary session was interrupted by gunmen storming the building.
Read more: http://www.bbc.co.uk/news/world-africa-27760288