Tintin and his dog visit their friends Captain Haddock and Professor Calculus. There, they learn that Bianca Castafiore, her maid Irma, pianist Igor Wagner and the detectives Thomson and Thompson have been imprisoned in San Theodoros for allegedly attempting to overthrow the government. Their government have further declared that the plot was thought up by Tintin, Haddock, and Professor Calculus. Tapioca invites the trio to visit San Theodores, promising them safe passage, but Tintin deems it to be a trap, leaving Haddock and Calculus to go alone. Once there, the Captain and Professor are taken to a rural villa, where they are closely monitored by the security services.
Tintin joins his friends a few days later, where he notices to Haddock and Calculus that their villa is troubled. He recognises one of the staff as Pablo, a man who had saved his life in The Broken Ear. From Pablo, Tintin learns that the entire scenario is a plot organised by Colonel Sponsz, a figure in the Bordurian military who is assisting Tapioca's government in order to gain revenge against Tintin for the events of The Calculus Affair.
With Pablo's assistance, Tintin, Snowy, Haddock, and Calculus escape from their guards and seek refuge with General Alcazar and his small band of anti-Tapioca guerrillas, the Picaros, who are hiding in the San Theodoran jungle. After realising that Pablo is a double agent working for Tapioca, they escape an attempt on their lives and then shelter for a time with the Arumbaya, an indigenous community who live within the forest. Here, Tintin is reunited with his old acquaintance, the explorer Ridgewell, who is living with the Arumbaya. Leaving the Arumbaya settlement, they eventually arrive at the Picaros' encampment, where they meet Alcazar's wife, Peggy.
Alcazar realises that the Picaros will not be able to launch a successful coup against Tapioca while they remain drunkards (owing to frequent parachute drops of whisky from Tapioca's forces), and to combat this problem Calculus provides them with tablets which render the taste of alcohol disgusting (and which he has been secretly testing on Haddock, Tintin, Ridgewell and the Arumbayas in the course of the story). Soon afterward, Jolyon Wagg and his troupe of carnival performers, the "Jolly Follies", arrive at the camp, having lost their way to Tapiocapolis where they mean to take part in the carnival. At Tintin's suggestion, the Picaros disguise themselves in the Follies' costumes and enter Tapiocapolis during the carnival. There, they storm the presidential palace and seize control; Alcazar becomes president, with Tapioca and Sponsz being exiled to Borduria. Thomson and Thompson are rescued from a firing squad, while Castafiore and her assistants are released from prison.
In the penultimate panel of the book, as Tintin, Haddock and Calculus's flight back home departs from the newly named Alcazaropolis, it flies over a slum that was seen earlier when they flew into the country. In a stroke of political commentary, the upheaval of the government has caused virtually no change to the slum or the lives of its inhabitants.