The film is set in the late 1920s. It opens in Morocco, with the French Foreign Legion returning from a campaign. Among them is Légionnaire Private Tom Brown (Gary Cooper). Meanwhile, on a ship bound for Morocco is the disillusioned nightclub singer Amy Jolly (Marlene Dietrich). Wealthy La Bessière (Adolphe Menjou) attempts to make her acquaintance, offering to assist her on her first trip to Morocco. When she politely refuses any help, he gives her his calling card, which she later tears up and tosses away.
They meet again at the nightclub where she is a new headliner. Also in the audience is Private Tom Brown (Gary Cooper). Amy, who comes out in a tophat and tails, is first greeted by boos, which she coolly ignores. Tom begins to clap, interrupting their jeers, and others follow suit. After the noise subsides she sings her number ("Quand l'amour Meurt" or "When Love Dies") and is met with ecstatic applause. Seeing a woman in the audience with a flower in her hair, she asks if she may keep it, to which the woman responds "of course". She playfully kisses the woman on the mouth, and throws the flower to Private Tom Brown. Her second performance ("What am I bid for my Apple?"), this time in feminine dress, is also a hit. After the number she sells apples to the audience, including La Bessière and Tom Brown. When Amy gives the latter his "change", she slips him her key.
That night, Tom sets out to take Amy up on her offer. On the street he encounters Adjudant Caesar's wife (Eve Southern). It is clear that she has a past clandestine relationship with him, which she desires intensely to maintain, but Toms rejects her. Entering Amy's house, they become acquainted. Her house is plastered with photos from her past, which she, like a Foreign Legion soldier, reveals nothing of. He asks Amy if the man in the photographs is her husband, and she answers that she has never found someone good enough, a sentiment shared by Tom. She has become embittered with life and men after repeated betrayals, and asks if he can restore her faith in men. He answers that he is the wrong man for that, and that no one should have faith in him. As they talk, she finds herself coming to like him. Unwilling to risk heartbreak once again, she asks him to leave before anything serious happens. As he leaves, he encounters Caesar's wife again. Her husband, Tom's commanding officer, watches undetected from the shadows. Meanwhile, Amy changes her mind and seeks Tom out. With Amy in arm, Tom leaves Madame Caesar, who then hires two street ruffians to attack the couple. Tom manages to seriously wound both, while he and Amy escape unscathed.
The next day, Tom is brought before Adjutant Caesar (who had been watching them clandestinely) on the charge of injuring two allegedly harmless natives. Amy clears him, but Caesar makes him aware that he knows about Tom's involvement with his wife. La Bessière, whose affections for Amy continue unabated, knows her concern for Tom and offers to use his weight with Caesar to lighten his punishment. Instead of a court martial, Tom is released from detention and ordered to leave for Amalfi Pass with a detachment commanded by Caesar. He suspects that Caesar intends to rid himself of his romantic rival, and fears for his life were he to go. Amy is saddened by the news that he is leaving. Meanwhile, Tom, war-weary and enamored with Amy, plans to desert to be with her.
That night at the nightclub, La Bessière enters Amy's dressing room. He gifts her with a lavish bracelet, which she attempts to refuse, before setting it on her table. At the same time Tom, intending to tell her of his plans, arrives at the door of her dressing room. Tom overhears La Bessière offer to marry Amy, an offer she politely turns down. La Bessière asks her if it is because she is in love, to which she responds that she doesn't think she is. Asking her if she would make the same choice if not for "a certain private in the Foreign Legion", she answers that she does not know. After hearing this Tom knocks on the door, and La Bessière kindly lets them alone so Tom can say goodbye to her. As they embrace, Amy tells him not to go, and he responds that that's what he intended to do. He will desert and board a train to Europe, but if she would join him. She agrees to this. A buzzer signals it is time for her to perform, and she asks him to wait for her to return. After she departs, he notices the lavish bracelet on her dressing room table. Though he has fallen in love with her himself, Tom decides that she would be better off with a rich man than with a poor Legionnaire. He writes on her mirror, "I changed my mind. Good luck!".
The next day Amy arrives with La Bessière to see the company's departure, so that she can bid Tom farewell. Adding further injury, he hides the depth of his feelings for her by having several women in his company, who cling to him so doggedly that Amy must maneuver herself between them to shake his hand. She asks La Bessière about the women trailing after the company, who explains that they follow the men. She wonders how they keep pace with them, and he answers "Sometimes they catch up with them, and sometimes they don't. And very often when they do, they find their men dead." Amy remarks that the women must be mad to do such a thing, to which La Bessière responds "I don't know. You see, they love their men."
On the march to Amalfi Pass, Tom's company detachment runs into a machine gun nest. Caesar orders Tom to deal with it, and Tom suspects it is a suicide mission. To his surprise, Caesar decides to accompany him. Caesar is killed by the enemy.
Though in a relationship with La Bessière, Amy pines for Tom. She is devastated by his treatment of her, and begins drinking heavily and acting erratically at work. La Bessière enters her dressing room to find her singing gayly. He asks if she is in high spirits because she has heard news of Tom. She leads him to the mirror to show him the note Tom left, which she had hidden behind a flower pot. Still concealing her grief, she asks him to pour her a drink, before throwing its contents on the mirror and breaking the glass. La Bessière consoles her, and Amy eventually accepts his proposal.
Later, at their engagement party, La Bessière and Amy learn that what's left of Tom's detachment has returned. Frantic, Amy rushes outside, but learns that Tom was wounded and left behind to recuperate in a hospital. She informs La Bessière that she must go to Tom that very night; and wanting only her happiness, he drives her there.
She finds that Tom has not been injured at all, but has instead been faking an injury to avoid combat. Instead of the hospital ward, he has been residing in a canteen. Accompanying him is a native woman, who attempts to console him, knowing he is brokenhearted over leaving his love. He has carved "AMY JOLLY" inside a heart, covered by a heap of cigarette butts from his chain smoking. When Amy arrives, Tom asks her if she is married, to which she answers in the negative. He then asks if she plans to marry La Bessière, to which she replies with a yes. He encourages her to marry him, not revealing his feelings for her. As he prepares to join his new unit, she finds his knife on the table, which he has forgotten. When he returns to collect it, she remarks that he has also forgotten to say goodbye. He asks her to see the unit off as they leave at dawn. Alone and distraught, Amy sifts through the pile of playing cards and cigarettes, and finds the heart with her name in it. The next morning she attends as his unit disembarks. Amy is torn in leaving him with the knowledge of his love for her, but when she sees a handful of native women stubbornly following the Legionnaires they love, she joins them.Gary Cooper as Légionnaire Tom Brown
Marlene Dietrich as Amy Jolly
Adolphe Menjou as Kennington La Bessière
Ullrich Haupt as Adjudant Caesar
Francis McDonald as Caporal Tatoche
Eve Southern as Madame Caesar
Paul Porcasi as Lo Tinto, nightclub owner
Emil Chautard as French general (uncredited)
Juliette Compton as Anna Dolores (uncredited)
Albert Conti as Colonel Quinnovieres (uncredited)
Thomas A. Curran (uncredited)
Theresa Harris as Camp Follower (uncredited)
Harry Schultz as German Sergeant (uncredited)
Michael Visaroff as Colonel Barratire (uncredited)
According to Robert Osborne of Turner Classic Movies, Cooper and von Sternberg did not get along. Von Sternberg filmed so as to make Cooper look up at Dietrich, emphasizing her at his expense. Cooper complained to his studio bosses and got it stopped.
When Dietrich came to the US, von Sternberg welcomed her with gifts including a green Rolls-Royce Phantom II which featured in some scenes of Morocco. The final scene is recreated in the 1946's Mexican film Enamorada, directed by Emilio Fernández.