In 1881, Chon Wang (pronounced as John Wayne) played by Chan is a Chinese Imperial Guard in the Forbidden City. After Princess Pei-Pei (Liu) for whom Wang has affection, is abducted and taken to the United States, the Emperor of China sends three of his guards along with the Royal Interpreter to retrieve her. Wang is not one of the three, but he tells the Captain of the Imperial Guards that it was his fault the princess was kidnapped and insists on joining them. The Captain first refuses, but when the Royal Interpreter, Wang's uncle, offers to allow Wang to come help with the baggage, the Captain agrees in the hopes that the "foreign devils" would get rid of Wang. In Nevada, Roy O'Bannon (Wilson) is an outlaw who, with his gang, hijacks the train Wang is on. When Wallace, a new member of Roy's gang, kills Wang's uncle, Wang chases the outlaws down. However, the gang is well-armed and Wang's only choice is to unhinge the cars and get away on the engine. In the process, Wallace takes over the gang from Roy, and they leave him buried up to his chin in the desert sand. Meanwhile, Pei-Pei, who was tricked into believing she was freely escaping her arranged marriage in China, finds out she has been kidnapped by an agent of Lo Fong, who ran away from the Forbidden City and was viewed as a traitor by the Chinese.When Wang finds Roy buried in the sand, he demands to know the direction to Carson City. Roy tells him that the city is on the other side of a mountain. Wang puts two chop sticks in Roy's mouth for him to dig himself out. When Wang comes out the other side of the mountain, he gets involved with a Sioux tribe by saving a boy chased by the Crow tribe and ends up reluctantly marrying the tribe chief's daughter, Falling Leaves. Wang finds a small town in the area, where he encounters Roy in a tavern. He confronts him, and ends up starting a fight with him that turns into a barroom brawl. The two of them get sent to jail, and after Falling Leaves helps them escape, they become friends. Roy trains Wang in the ways of the cowboy.When they get to Carson City, Roy discovers that both he and Wang, now identified as the "Shanghai Kid" are wanted by Lo Fong's ally Marshal Nathan Van Cleef, and the two of them narrowly escape. They go to a bordello (which Roy describes as his "hideout"), but after a drunken encounter by Wang, the Marshal eventually catches and arrests them. They find out that Lo Fong is behind the kidnapping of the princess. As they are about to be hanged, Wang manages to break himself free and after Falling Leaves shoots Roy loose, they escape the execution site. Wang, upset over Roy previously telling one of the prostitutes at the bordello he was not Wang's friend, rides off alone to find the princess. When he finds her in Lo Fong's labour camp, she tells him that she does not wish to return to China. Fong finds out about Wang and attacks him. However, Roy, who has followed Wang, saves him from Fong and the two reunite.The next day, the two partners go to the ransom point, the Carson City Mission church. The three imperial guards arrive with the gold, and Lo Fong has the princess in hand. However, a simple exchange becomes complicated when Wang shows up and Roy points a gun towards Fong. Wang tells his fellow guards that he will not allow them to bring the princess back to China. As the Chinese and Lo Fong fight amongst themselves, Van Cleef arrives and engages Roy in a gunfight. After Roy is limited to one remaining bullet, Van Cleef simultaneously fires both of his guns but Roy (unscathed due to all of Van Cleef's shots missing him and going through the priest's robe he wore for a disguise) shoots him in the heart, through his sheriff's star. Wang fights the Imperial Guards whilst Lo Fong chases Pei-Pei through the rafters of the church, but eventually the Guards allow Wang to go to her aid instead. Wang fights Lo Fong to the bell tower, and Pei-Pei is wounded in the fight. Wang ultimately kills Lo Fong by dismantling the bell, causing it to hang him. After the fight, the Imperial Guards agree to let Pei-Pei remain in Nevada to help the enslaved Chinese people.Wallace and his gang also come up to the church, and demand that Roy and Wang come out and fight. But when the two of them get outside the church to face Wallace, Natives from all around surround the gang. At a Chinese cultural celebration Roy thanks Falling Leaves for saving him and they engage in a passionate kiss. At the same time, Pei-Pei holds a smiling Wang's hand. In the final scene, Roy and Wang are shown as sheriffs and ride off to catch a new band of train robbers.
Output: Question: What was the reason Wallace and his gang demanded Roy and Wang come out of the church?, Answer: to fight