The film celebrates the 1920s French Foreign Legion. Foreign Legion Major Foster (Hackman), a war-weary American haunted by his memories of the recently ended Great War, is assigned to protect a group of archaeologists at a dig site in Erfoud in Morocco from Bedouin revolutionaries led by El-Krim (based on Moroccan revolutionary Abd el-Krim).
The song Plaisir d'amour, a tune about lost love and regret is heard repeatedly through the film, serving as film's theme song.
Soon after the Great War, Major Foster (Hackman), the commander of a detachment of the French Foreign Legion, suffers the haunting memories of leading an army of 8,000, now reduced to 200. He has become an alcoholic as a result, and his only friend is his faithful Sergeant, Triand (Rufus Narcy).
Foster arrives in Paris to assume a new command: to return to the Rif (Morocco) to re-establish French authority, as Bedouin and Berber tribes have begun to revolt against French rule. Foster is also ordered to escort archaeologists from the Louvre, who are uncovering an ancient city near Erfoud buried by a sand storm 3,000 years ago. The site is the final resting place of a Berber saint, "The Angel of the Desert". Foster was chosen for the assignment, as he is the only French officer alive who served in Morocco before the war. He had helped to develop diplomatic ties with the tribes, especially with El Krim, the de facto leader of the scattered Rif tribes. Foster had vowed to El Krim that there would be no further archeological excavations.
Foster’s force is assembled. Among those who volunteer, willingly or unwillingly, is "the Gypsy" Marco Segrain (Terence Hill), a charming jewel thief famous for a three-year crime spree on the Riviera until French authorities managed to apprehend him. Gypsy befriends three other recruits: the Russian giant Ivan (Jack O'Halloran), formerly a member of the elite bodyguard of the deposed Russian Imperial family; "Top Hat" Gilbert Francis (André Penvern), a fashionable man and musician who lacks the physical traits needed in a soldier; and Fredrick Hastings (Paul Sherman), a romantic young English aristocrat who missed the Great War.
The four friends are soon disillusioned by the harsh realities of life in the Legion. A fatal fight breaks out among the men while traveling to Morocco over an insult to Maj. Foster's honor, to which Sgt. Triand takes exception. Foster does not hesitate to harshly discipline his men, especially Marco, who frequently disobeys orders, though he does care for his men. During the voyage, Marco charms Mme. Picard (Catherine Deneuve), daughter of a murdered archaeologist.
During their land journey to the Legion fortress, the train carrying the Legionnaires and the archaeological team is stopped by El Krim (Ian Holm) and his men. El Krim greets his old friend Foster but also declares that he is determined to unite the Berber tribes to drive the French out of Morocco. El Krim gives a "gift" to Foster to take back to the Premier of France: the archeologists of an earlier dig, who have been blinded and whose tongues have been cut out. He warns Foster not continue the excavation.
Training in the desert is so harsh, it pushes Top Hat to commit suicide. Later, at the digging site, Hastings is kidnapped while on guard duty and tortured to death by one of El Krim’s men, whom El Krim excuses as being merely over-zealous. Marco retaliates. Instead of disciplining him, Foster merely defends him, using El Krim’s previous excuse for the actions of his own man.
Eventually, the tomb of the Angel of the Desert is found, and her golden sarcophagus is excavated. Foster offers it to El Krim as a token of peace, but El Krim rallies the warriors of all Bedouin tribes to fight a climactic battle. With the Legionnaires being heavily outnumbered, the digging site is eventually overrun. Ivan is killed, but Marco fights on, single-handedly fending off a flank attack. When Foster is killed, El Krim immediately calls off the fight, sending the surviving Legionnaires "to tell the world what happened" and out of respect for his dead friend.
There are two endings: the TV version ends with Marco taking up Mme Picard's offer to desert. The theatrical ending shows Marco (after having been promoted for his bravery in battle) staying behind and training more Legionnaire recruits, welcoming them by reiterating Foster's warning: "If the Legion doesn't get you, the desert will. If the desert doesn't, the Arabs will. And if the Arabs don't, then I will. I don't know which is worse."
In the TV version, there were several scenes that were not included in the theatrical or in the video/DVD versions of the film. One pivotal extra scene occurs when the excavation work has commenced and it is discovered that two of the Legionaries, both of them German recruits, have deserted. The sadistic second-in-command of the company, Lt Fontaine and his equally vicious crony the Corporal lead a patrol to capture them. They catch up with the two Germans and Fontaine orders the patrol to shoot them. The noise attracts a large group of Bedouin tribesmen and, disregarding the warnings from his men, Fontaine orders his men to open fire, igniting a battle. The Corporal is shot dead and Fontaine breaks down in fear and kills himself. Marco displays his courage and natural flair for leadership by rallying the survivors of the patrol and successfully beating off the attackers. In the video release, this scene was omitted but brief shots of Fontaine and the Corporal were taken from this scene and edited into the climactic battle at the digging sight so it appears that both men died there instead.
Dick Richards had been interested in the French Foreign Legion ever since he found out a friend of his uncle's had joined the legion.
Most of the finance was provided by Lew Grade's ITC Company on the basis of Terence Hill's popularity. It was Hill's second film aimed at the American market.
Filming started 23 August 1976. It was mostly shot in Spain.
Gene Hackman was injured during filming after he was thrown off a horse. This caused filming to be suspended.
According to Lew Grade the film "went well over budget when Gene Hackman suffered an accident and lost money".