America’s favorite World War II movie has led a charmed life. While it was being filmed, each looming disaster turned out to be a cleverly disguised blessing, and after its completion everything that could go right did go right. But of all the lucky accidents it enjoyed on its way to screen immortality, the fact that shooting began before there was a finished script may have been the most providential.

Had there been a completed screenplay before filming started in May 1942, the studio would have been obliged to send a copy to the Bureau of Motion Pictures. The bureau, a division of the Office of War Information, was nothing less than a ministry of propaganda that sat in judgment on the content of Hollywood’s products. Although the studios’ cooperation with the BMP was on a voluntary basis, bureaucrats were nevertheless allowed to sit in on story conferences, suggest changes, and on occasion write patriotic speeches for insertion into scripts.

When the BMP finally viewed the finished film, its members were unhappy about the character of Rick—he was too cynical for too long—and concerned about the way our Allies the French were depicted. Warner Brothers might well have made the changes requested except that on November 8, 1942, American and British troops landed at various points along the North African coast, including Casablanca. This led to the first major victory against the Nazis since the war began, and the film was rushed into one of Warners’ Manhattan theaters, the Hollywood, on November 26. In January Casablanca was put into general release—exactly when Roosevelt was meeting with Churchill and de Gaulle at, of course, Casablanca.

This fortuitous confluence of history and Hollywood hokum so excited Jack Warner that he considered adding an epilogue to the movie, using clips of the Casablanca Conference. Cooler heads prevailed, however, and Churchill and Roosevelt remained confined to the newsreels. Casablanca became a smash hit anyway. All those connected with the film, even bit players, found their careers shining more brightly than ever, with one exception—Murray Burnett, who conceived the play on which the movie was based. Burnett was clever enough to invent the “letters of transit” device that sets the plot in motion but not smart enough to see a lawyer before signing his contract. Here’s what happened.

In the summer of 1938 Burnett, a teacher at Central Commercial High School in New York City, traveled to Nazi-occupied Vienna with his wife to try to help her stepfather’s family escape from Austria. There the Burnetts learned about the “refugee trail” across the Italian Alps to France, down to Marseilles, then Casablanca, Lisbon, and finally, perhaps, America. After doing what they could in Vienna, they began their return, stopping off in a French resort town on the Mediterranean. There they dropped into a small nightclub, La Belle Aurore—a place crowded with refugees speaking all the languages of Europe, peppered with both French and German officials, and featuring, to complete the international ambience, a black piano player who performed old Tin Pan Alley favorites.

The café seemed to Burnett the perfect setting for a play. The music recalled his college days at Cornell, when he used to anger his fraternity brothers by constantly playing his favorite record, “As Time Goes By.” The European experience stayed with him, and during the summer of 1940 (France had fallen; the Vichy government marched to the German tune), Burnett and his collaborator, Joan Alison, put it on paper. The setting is Rick’s Café Américain, a Casablanca nightclub with a black piano player named Sam. Cynical Rick Blaine, once a famous criminal lawyer in Paris, is proprietor. When his long-lost love, fellow American Lois Meredith, turns up at his bar with the Czech patriot Victor Laszlo, who is fleeing the Nazis, the plot’s fuse is lit. In the play Rick manages to get them out of Casablanca and then surrenders himself to the German and Vichy French authorities. The title was Everybody Comes to Rick's.

Within six weeks the play was finished and optioned to the producers Martin Gabel and Carly Wharton, who thought it needed the input and cachet of a “name author.” Ben Hecht and Robert Sherwood, among others, were sent scripts, and all came to the same conclusion: no major rewrite was necessary. Still, the producers remained uneasy about a play in which the heroine seduces the hero, even for so crucial a matter as letters of transit. In time they dropped the option. Fed up with the New York theater scene (this was their third play that had been optioned and never produced), Burnett and Alison told their agent to try Hollywood.