During World War II, the city of Casablanca, located in French Morocco, becomes a crucial stop for countless refugees attempting to escape the grip of Nazi-occupied Europe. As exit visas are hard to come by, a significant incident occurs when two German couriers carrying valuable letters of transit—endorsed by the Free French resistance figure, General Charles DeGaulle—are mysteriously murdered, leading to a wave of fear among the populace as authorities scramble to apprehend all unknown faces within the city.
The tension escalates with the arrival of German Major Heinrich Strasser (Conrad Veidt), a prominent Nazi officer, who is welcomed at the airfield by Captain Louis Renault (Claude Raines). In their discussions, both express concern over the stolen letters and reveal their intent to ensure they do not fall into the hands of Victor Lazlo, the renowned Czech resistance leader rumored to be making his way to the city.
As night falls, Renault and Strasser venture into Rick's Café Americain, a bustling nightclub owned by the enigmatic American expatriate, Richard 'Rick' Blaine (Humphrey Bogart). While sipping a drink in solitude within the gambling room, Rick encounters the dubious Ugarte ([Peter Lorre]), who requests Rick to conceal the stolen letters temporarily. Ugarte, looking to profit from their sale, believes this will allow him to escape Casablanca safely. Rick hides the letters in a piano played by his talented bandmaster, Sam (Dooley Wilson).
Shortly thereafter, Rick faces an offer from the Blue Parrot nightclub owner, Ferrari ([Sydney Greenstreet]), who wishes to buy out Rick; however, he declines. It becomes apparent that Ferrari also deals in forged exit visas, marking the underbelly of Casablanca's economy. Amidst the chaos, Rick's only allies are his devoted employees, including the vivacious maître d', Carl ([S.Z. Sakall]) and the Russian bartender Sascha ([Leonid Kinskey]). A confrontation arises with Yvonne ([Madeleine LeBeau]), a young French woman who once captured Rick's heart, leading him to coldly declare that he "sticks his neck out for nobody," a testament to his bitter transformation over time.
As tensions rise, Ugarte's arrest occurs in a dramatic scene, soon followed by the entrance of Lazlo ([Paul Henreid]) and his companion, Ilsa Lund (Ingrid Bergman). Upon recognizing Sam, Ilsa demands he play "As Time Goes By," a song that stirs painful memories for Rick, prompting him to confront her about their tumultuous past. A series of flashbacks unveil a once joyful love affair in Paris, shadowed by betrayal when Ilsa chooses to abandon Rick at a critical moment, intending to protect him from the Nazi threat.
The very next day, Lazlo and Ilsa visit the police station, learning about Ugarte's tragic demise while in custody. In a turn of fate, as Rick assists a young Romanian couple to secure their freedom through roulette, Lazlo indirectly hints at the stolen letters. The atmosphere grows electric when Lazlo braves the gathering of German officers to request the band to play "La Marseillaise," leading the patrons of Rick's café to collectively defy the oppressive presence of Strasser and his men.
A significant encounter takes place later between Rick and Ilsa, where she divulges the truth behind her decisions: she had believed her husband Lazlo was dead when she chose to stay in Paris. Despite the rekindling of their feelings, a burden of decisions weighs upon them. With the police on the prowl, Lazlo urgently implores Rick to help Ilsa escape.
In a pivotal moment of courage, Rick sells his café to Ferrari, leveraging his resources to aid Lazlo's escape from the police. They rush to the airport, but their path is obstructed by Strasser. Seizing the moment, Rick confesses to Ilsa about their broken past and suggests she leaves with Lazlo, recognizing the profound importance of their mission. In a climactic showdown, Rick shoots Strasser as he attempts to sabotage their departure. In a moment of unexpected camaraderie, Renault counters Strasser’s call for capture, advising to "round up the usual suspects."
The film concludes on a hopeful note as Rick and Renault plan their escape from Casablanca to join forces with the Free French. With a final sentiment, Rick fervently remarks, > "Louie, I think this is the beginning of a beautiful friendship," hinting at a new chapter that awaits them beyond the horizon.