Rick, who says "I stick my nose out for nobody," is a disillusioned expatriate from America who has a nightclub in Vichy-controlled Morocco in Africa in the early days of World War II. He believes in no one or anything after his girlfriend fails to show up when they plan to flee German-occupied Paris where they have fallen in love.
At Rick's club, petty crook named Ugarte, who has no morality, has killed two German couriers in order to obtain two letters of transit. These letters permit the holder to travel Europe that is occupied by the Germans as well as to neutral Portugal. Obviously, these papers are extremely valuable to refugees who come to Rick's Cafe because they cannot return to Europe. Ugarte plans to sell them at a great profit, but because the police may search him, he entrusts the papers to Rick. Before he can sell them, however, Ugarte is arrested by the local police, Vichy Captain Louis Renault, who is morally corrupt as he accepts bribes.
When he is confronted by his former love, Ilsa Lund, the seemingly amoral Rick faces a moral conflict between renewing his love for her or helping her husband, Czech Resistance leader. In the end, he proves himself of the highest moral character as he insists that Ilsa remain with her husband and take the letters of transit and flee Morocco. In so doing, Rick saves Victor Lazlo from the German police because he also convinces Renault that he should release Lazlo from jail in order to make a much bigger arrest later. However, as Lazlo is due to arrive at the airport, Rick tricks Renault and forces him to aid Lazlo escape from German officer Major Strasser.
So, while Rick manipulates people which is unethical, he does possess a sense of moral responsibility as he rejoins the "fight" as Lazlo congratulates him because of his involvement with the him and the Resistance. (Lazlo knows that Rick fought on the Loyalist side in the Spanish Civil War and ran guns to Ethiopia to fight Italian forces.)