In December 1941, American expatriate Rick Blaine owns an upscale nightclub and gambling den in Casablanca. “Rick’s Café Américain” attracts a varied clientele, including Vichy French and German officials, refugees desperate to reach the neutral United States, and those who prey on them. Although Rick professes to be neutral in all matters, he ran guns to Ethiopia during Second Italo-Ethiopian War and fought on the Republican (loyalist) side in the Spanish Civil War.
Petty crook Ugarte boasts to Rick of “letters of transit” obtained by murdering two German couriers. The papers allow the bearers to travel freely around German-occupied Europe and to neutral Portugal; they are priceless to the refugees stranded in Casablanca. Ugarte plans to sell them at the club, and asks Rick to hold them. Before he can meet his contact, Ugarte is arrested by the local police under the command of Captain Louis Renault, the unabashedly corrupt prefect of police. Ugarte dies in custody without revealing that he entrusted the letters to Rick.
Then the reason for Rick’s cynical nature—former lover Ilsa Lund—enters his establishment. Spotting Rick’s friend and house pianist, Sam, Ilsa asks him to play “As Time Goes By”. Rick storms over, furious that Sam disobeyed his order never to perform that song and is stunned to see Ilsa. She is accompanied by her husband, Victor Laszlo, a renowned, fugitive Czech Resistance leader. They need the letters to escape to America to continue his work. German Major Strasser has come to Casablanca to see that Laszlo fails.
When Laszlo makes inquiries, Ferrari, a major underworld figure and Rick’s friendly business rival, divulges his suspicion that Rick has the letters. Privately, Rick refuses to sell at any price, telling Laszlo to ask his wife the reason. They are interrupted when Strasser leads a group of officers in singing Die Wacht am Rhein (“The Watch on the Rhine”). Laszlo orders the house band to play La Marseillaise. When the band looks to Rick, he nods his head. Laszlo starts singing, alone at first, then patriotic fervor grips the crowd and everyone joins in, drowning out the Germans. Strasser demands Renault close the club, which he does on the pretext of suddenly discovering there is gambling on the premises.
Ilsa confronts Rick in the deserted café. When he refuses to give her the letters, she threatens him with a gun, but then confesses that she still loves him. She explains that when they met and fell in love in Paris in 1940, she believed her husband had been killed attempting to escape from a concentration camp. While preparing to flee with Rick from the imminent fall of the city during the Battle of France, she learned Laszlo was alive and in hiding. She left Rick without explanation to nurse her sick husband. Rick’s bitterness dissolves. He agrees to help, letting her believe she will stay with him when Laszlo leaves. When Laszlo unexpectedly shows up, having narrowly escaped a police raid on a Resistance meeting, Rick has waiter Carl spirit Ilsa away. Laszlo, aware of Rick’s love for Ilsa, tries to persuade him to use the letters to take her to safety.
When the police arrest Laszlo on a trumped-up charge, Rick persuades Renault to release him by promising to set him up for a much more serious crime: possession of the letters. To allay Renault’s suspicions, Rick explains that he and Ilsa will be leaving for America. When Renault tries to arrest Laszlo as arranged, Rick forces him at gunpoint to assist in their escape. At the last moment, Rick makes Ilsa board the plane to Lisbon with Laszlo, telling her that she would regret it if she stayed—”Maybe not today, maybe not tomorrow but soon and for the rest of your life”. Strasser, tipped off by Renault, drives up alone and Rick shoots him when he tries to intervene. As the police arrive, Renault pauses, then orders them to “round up the usual suspects”. He suggests to Rick that they join the Free French in Brazzaville. As they walk away into the fog, Rick says, “Louis, I think this is the beginning of a beautiful friendship”.