How a decade of conflict and division put Libya in peril of disaster