RIO DE JANEIRO — President Jair Bolsonaro of Brazil has vowed to pursue drug traffickers relentlessly. So he was hard-pressed to explain how a presidential plane ended up carrying 86 pounds of cocaine across the Atlantic during an official trip.

A Brazilian airman on that aircraft was caught with the shipment on Tuesday during a brief stop in Spain en route to the Group of 20 summit in Japan, Brazilian and Spanish officials said Wednesday.

The cocaine bust was bad enough. But it was an extraordinary embarrassment for Mr. Bolsonaro, who has exalted the integrity and professionalism of Brazil’s military.