Libya, a North African nation splintered by a war, was ill-prepared for the storm, which swept across the Mediterranean Sea to batter its coastline.