It tries to make the operetta topical in terms of World War II, by having the outlaw hero with a dual identity fight the Nazis as well as the Riffs.
In fact, the United States Office of War Information held up release of the film for a year because of the shifting political positions of Vichy France.
In 1939, the efforts of Moroccan Caid Yousseff to build a private railroad to Dakar are continually interrupted by attacks by the native Riffs under the leadership of the mysterious El Khobar, who is actually American Paul Hudson, a veteran of the Spanish Civil War.
When Johnny Walsh, an American journalist stationed in Morocco, tries to make the attacks public, his efforts are blocked by the French censor.
Later, Paul, who is also a café piano player, informs French singer Margot that the Riffs oppose Yousseff but not France.
The following day, Yousseff meets with Colonel Fontaine, who is his partner in the railroad deal, which is financed by the Nazi government.
Yousseff suggests that Fontaine search for El Khobar in the native cafés where his spies are thought to congregate, taking Margot along to hide his real purpose.
Because Margot is friendly with Fontaine, Paul invites her to the desert, where he plans to question her, and she discovers that he is El Khobar.