Libya has been plunged into chaos since the ouster of the dictator Col. Muammar el-Qaddafi in 2011, with rival cities and militias competing for power. The bedlam has slashed the country’s oil production, drained much of its sovereign wealth, offered havens to Islamist militants and turned its long Mediterranean coast into a major point of departure for African and Middle Eastern migrants fleeing to Europe.