A court in Libya on Sunday sentenced 12 current and former officials to terms of up to 27 years in prison over their involvement in the collapse of two dams last year that sent a wall of water several meters high through the center of a coastal city.