NIAMEY, Niger—Diplomats, spies and hostage negotiators gather nightly on the moonlit terraces of colonial-era hotels in this remote desert capital to trade intelligence on security threats.

Foreign bases and vast new embassy complexes are rising along sand-caked streets. In the shadows, smugglers move migrants, guns and drugs across lawless territory.

Niger,...