Something very unusual has happened in Libya where law and order has long seemed a thing of the past. The law has worked. The Libyan Supreme Court was asked to decide if the parliamentary election of Ahmed Maiteg was undertaken according to the rules. The legislature, the General National Congress, held a ballot which did not produce the required minimum number of votes. However, in a controversial recount, which apparently included the votes of congressmen who had not originally been in the chamber, Maiteg was declared duly elected. The outgoing caretaker PM, Abdullah Al-Thinni, however, disputed the result and refused to hand over the office. Thinni had been appointed by the GNC as interim premier after Ali Zeidan was fired by legislators. Yet following an attack on his home by an unidentified group, Thinni said he wanted to relinquish the job. Either Thinni had changed his mind about quitting or he felt it his duty to insist that his successor be properly appointed. The standoff left legislators divided and created further schisms in an already fractured body politic. The dispute was sent to the Supreme Court, whose judges had been due to deliver their verdict last Thursday. There was widespread despair when they announced that they were delaying their decision until Monday. The assumption was that they either could not agree, or influenced by the prevailing violence, even in the capital Tripoli, were frankly too scared to make a decision. Both suppositions were wrong. The judges delivered a clear ruling that Maetig's selection had been unconstitutional. Even more impressively, Maetig himself went on air in the evening to say that he accepted the ruling. Thinni, therefore, remains prime minister. Yesterday, there were some desultory moves among GNC members to rerun the selection but most legislators seem not to have the heart for it. This is in large part because elections are due on June 25 for a new House of Representatives which will replace the widely-discredited GNC. What happens next could be crucial for Libya. Last week, Thinni and many of his cabinet went to Benghazi, in the east of the country, where he made clear his support for the rebel general Khalifa Hafter. He is leading an assault on the Jihadist Ansar Al-Sharia which has links with Al-Qaeda in the Islamic Maghreb (AQIM) and has been blamed for scores of killings of security force members, journalists and civil society activists in the past year. Though many Libyans are nervous about Hafter's ambitions, in the short term at least, there is considerable support for his attempt to end the violence. Though armed groups in and around Tripoli have said they back the general, the powerful Mistrata militias, which saw the toughest fighting during the revolution, have not. Maetig is a Misratan businessman and Misrata made a point of saying it protected the GNC. When Thinni returns to Tripoli with his ministers, arguably, he will be less secure than in the east. But were he to seek to run the government from Benghazi, he could create a potentially catastrophic split in the country. Libya is very far from being a functioning, peaceable state, as the UN's local representative made clear in his report this week to the Security Council. But in all the chaos and uncertainty, the wisdom and strength of the Supreme Court judges demonstrates that the flame of law and order still burns in the country, even if it is low and guttering.