His reputation brought into disrepute by Captain Bagshaw, a competitor for the affections of Lady Jane Ponsonby, Bertram Oliphant West AKA "Bo" decides to leave England and join the French Foreign Legion, followed by his faithful manservant Simpson. Originally mistaken for enemy combatants at Sidi Bel Abbès, the pair eventually enlist and are helped in surviving Legion life by Sergeant Knocker, although only after they discover that when he is "on patrol" he is actually enjoying himself at the local cafe with the female owner, ZigZig.
Meanwhile Lady Jane, having learnt that Bo was really innocent, heads out to the Sahara to bring him back to England. Along the way she has several encounters with men who exploit the fact that she is naive and travelling alone. After several such run-ins, including with the Legion fort's Commandant Burger (who incidentally once was her fencing teacher and joined the Legion in self-imposed shame after he had inadvertently cut her finger during a lesson), she meets Sheikh Abdul Abulbul and ends up becoming a part of his harem and planned 13th wife.
Knocker and Bo are kidnapped by Abulbul after being lured to the home of Cork Tip, a belly dancer at the Café ZigZig. Simpson follows them to the Oasis El Nooki but is also captured. After entering Abulbul’s harem and discovering Lady Jane, Bo and Simpson give themselves up while Knocker escapes (or rather is allowed to by Abulbul) back to Sidi Bel Abbes to warn Commandant Burger of Abulbul’s plans to attack Fort Zuassantneuf.
However during this time ZigZig has told the Commandant about Knocker's true destination when on patrol and therefore upon his return his story is not believed. It is only when Knocker mentions Lady Jane that they realise he was telling the truth and the Commandant organises a force to reinforce the fort.
After learning that Abulbul's celebration of the successful attack includes marrying Lady Jane, Bo, Burger, Knocker and Simpson rescue her from his tent, leaving Simpson behind dressed as a decoy. When Abulbul discovers the deception, he chases Simpson back to the fort where, through the imaginative use of a gramophone and a German marching song, gum arabic, coconuts, gunpowder and a cricket bat, the group holds off Abulbul’s army until a relief force arrives. However, Commandant Burger ends up as a (and the sole) casualty among the protagonists.
Back in England the group reunites for a game of cricket, with Knocker having been promoted to Commandant and Lady Jane having conceived a son by the late Burger. Bo is batting, but when he hits the ball, it explodes. The bowler is then shown to be Abulbul having gained his revenge, to which Bo, with a broken bat and burnt clothes, good-naturedly responds "Not out!"