During World War II, Casablanca, Morocco is a waiting point for throngs of desperate refugees fleeing Nazi-occupied Europe. Exit visas, which are necessary to leave the country, are at a premium, so when two German couriers carrying letters of transit signed by General DeGaulle are murdered and the letters stolen, German Major Strasser and Louis Renault, the prefecture of police, are eager to find the documents. Strasser is particularly concerned that the letters not be sold to Victor Lazlo, the well-known Czech resistance leader, who is rumored to be on his way to Casablanca. That night, Renault and Strasser search for the killer at Rick's Café Americain, a popular nightclub run by the mysterious American ex-patriot Richard Blaine. Earlier, Ugarte, a shady dealer in exit visas, had asked Rick to hold the stolen letters temporarily, explaining that he has a buyer for them and with the money from their sale, he plans to leave Casablanca. Although Rick fought on the side of the loyalists in Spain, he has grown cynical, and when Renault advises him not to interfere with Ugarte's arrest, Rick replies "I stick my neck out for nobody." He makes a bet with Renault, however, that Lazlo will manage to leave Casablanca despite German efforts to stop him. After Ugarte is arrested, Lazlo and his companion, Ilsa Lund, arrive at Rick's. Ilsa recognizes Sam, the piano player, and while Lazlo makes covert contact with the underground, Ilsa insists that Sam play the song "As Time Goes By." Reluctantly, Sam agrees, and a furious Rick, who had ordered him never to play the song again, emerges from his office to stop him. Rick is taken aback when he sees Ilsa, whom he knew in Paris. Later, after the café is closed, Rick remembers his love affair with Ilsa: After a brief happy time together, the Nazis invade Paris and, worried that Rick will be in danger because of his record, Ilsa advises him to leave the city. He refuses to go without her, and she agrees to meet him at the train station. Instead of coming, though, she sends him a farewell note, and Sam and Rick leave just ahead of the Nazis. Rick's thoughts return to the present with Ilsa's arrival at the café. She tries to explain her actions, but when a drunken Rick accuses her of being a tramp, she walks out. The following day, Lazlo and Ilsa meet with Renault and, there they learn that Ugarte has been killed while in police custody. After Rick helps a young Romanian couple win enough money at roulette to allow them to leave the country, Lazlo, suspecting that Rick has the letters, asks to buy them. Rick refuses and, when Lazlo asks his reasons, suggests that he ask Ilsa. Angered when Rick allows his orchestra to accompany a rousing rendition of "La Marseillaise," Strasser orders the closing of the Café. That night, while Lazlo attends an underground meeting, Ilsa meets Rick and explains that she stayed behind in Paris because, on the day Rick left Paris she had learned that Lazlo, her husband, whom she had married in secret and thought dead, was alive. Now realizing that they still love each other, Ilsa tells Rick that he must made decisions for both of them. Meanwhile, the police break up the underground meeting, and Lazlo takes refuge at Rick's. Before he is arrested, he begs Rick to use the letters to take Ilsa away from Casablanca. The next day, Rick sells the café to his competitor Ferare, the owner of the Blue Parrot, and tricks Renault into releasing Lazlo from prison. They head for the airport, but Renault has managed to alert Strasser, who hurries after them. At the airport, Rick tells Ilsa, who thought that she would be staying with him, that she is to leave with Lazlo because she gives meaning to his work. He then tells Lazlo that he and Ilsa loved each other in Paris, and that she pretended she was still in love with him in order to get the letters. Lazlo, who understands what really happened, welcomes Rick back to the fight before he and Ilsa board the plane. Strasser arrives just as the airplane is about to take off and when he tries to delay the flight, Rick shoots him. Renault then quickly telephones the police, but instead of turning in Rick, he advises them to "round up the usual suspects," and the two men leave Casablanca for the Free French garrison at Brassaville. It is, Rick says, "the beginning of a beautiful friendship."