After months of using Freemason secrets to trick the natives of Kafiristan, Danny Dravot (Sean Connery) begins to be unsatisfied with just being king, and decides that he should be treated as a god, and breaking his pact with Peachy Carnahan (Michael Caine), he decides to take a wife. During the ceremony, the bride-to-be scratches his face, and the fact that he bleeds reveals that he is mortal. He is killed by the angry mob.
In the framing story, Peachy narrates how he was then tortured, mutilated, and finally released. To prove his story, he shows Rudyard Kipling (Christopher Plummer) his one possession–the severed head of Danny, wearing the crown of Kafiristan.
The film begins with a haggard and filthy man walking into the office of Rudyard Kipling (Christopher Plummer – playing the real-life author of the short story this film is based on). Soon, Kipling realizes this man is Peachy Carnehan (Michael Caine), a former soldier and fellow mason whom he had met several years prior.
The story flashes back to that first meeting, which takes place in colonial India. Peachy steals Kipling’s watch, but upon seeing the symbol of the masons on the chain, returns it to Kipling. The pair become friendly and Kipling realizes that Peachy and his associate, Daniel Dravot (Sean Connery), intend to blackmail a local government official. He turns them in to the police but convinces the policeman not to charge the pair with any crime due to their status as masons (with Kipling theorizing that the masonic brotherhood extends back to before the time of Jesus Christ). We also learn that Daniel and Peachy are former military men who have since engaged in all sorts of schemes. Instead of being thrown in jail, the officer threatens to deport the pair.
Later, Daniel and Peachy visit Kipling and tell him of their plans. They intend to smuggle guns across Afghanistan to an uncivilized territory called Kafiristan. Once there, they intend to use their superior military tactics and weapons to help a warlord rise to the level of king. Once complete, the pair will overthrow the king and become kings themselves. Kipling thinks their idea is crazy, noting that Alexander the Great (born centuries earlier) was the last European to make it across Afghanistan alive. The duo are undeterred and even draft and sign a contract to memorialize their quest (the contract includes, amongst other things, a promise not to sleep with any women until they become kings). Kipling is clearly inspired by their scheme and gives Daniel a necklace bearing the symbol of the masons as a farewell gift.
The twosome successfully make the trek across Afghanistan while disguised as local mystics. They almost die climbing the mountains to Kafiristan, making it to the territory only by a stroke of luck. They soon rescue a group of natives who were being attacked and are taken in by the natives’ local warlord. At the village, they meet a native man named Billy Fish (Saeed Jaffrey) who learned English while working for a group of European explorers that died while trying to summit the mountains. With Billy’s help, the pair convince the warlord to let them train his soldiers and arm them with guns. Though both are tempted to sleep with the native women, but manage to maintain their vow of chastity.
Eventually, the pair lead the warlord’s troops into battle. They obliterate the opposing forces but ingratiate themselves to their enemies by incorporating their foes into their army, not raping their women, and allowing the people to keep half of their wealth. During one battle, a combatant shoots an arrow into Daniel’s chest. The arrow gets lodged in his bandolier, so it does not even wound him. The natives that witness this believe Daniel is a god and the son of Alexander the Great (who was prophesied to return). Daniel, Peachy and Billy agree to perpetuate this myth a. The people overthrow the warlord and Daniel is put in charge of the now massive native army. Daniel’s legend spreads and instead of opposing him, the other factions begin joining the new god.
Soon, the high priests of the region (and de facto rulers) request to meet the trio. To test Daniel’s claims, they rip open his shirt and intend to stab him to see if he will bleed (if he doesn’t he is truly a god). When they rip open his shirt, however, they see the necklace with the masonic symbol that Kipling had given them. The priests recognize it as the same symbol Alexander the Great carried (proving Kipling correct about the longevity of the masonic brotherhood) and deem him a god without trying to kill him. They are brought to Alexander the Great’s treasury and told that the unfathomable riches are theirs to do with as they like. Daniel is also declared god-king. Peachy, Daniel and Billy decide to split the treasure three ways and begin their return to Britain in the spring when it is easier to traverse the mountains.
In that time, however, Daniel truly takes to his position of god-king. Even Billy begins to believe in Daniel’s godly nature. Only Peachy scoffs at the notion of Daniel as a true god and the two have a falling out. Things go well until Daniel decides to make one of the native women his wife. The priests are opposed to this as they believe gods are not to copulate with humans. The woman herself resists as legend states that any mortal that sleeps with a god will erupt in flame. Daniel forges ahead with his plans to marry her anyways. He and Peachy eventually make up. Peachy decides to leave with his third of the treasure after Daniel’s wedding. Daniel wants to stay to help build Kafiristan into an actual civilized country.
At the wedding, the local woman bites Daniel when he tries to kiss her. Seeing his blood, the priests realize that Daniel is not a god, but only a mere mortal. The priests and many of the natives chase after Daniel and Peachy. Billy dies trying to stop the mob. Eventually, the men are caught. Daniel is made to stand on a bridge over a massive gorge that he had ordered built. The natives then chop down the supports and he topples to his death when the bridge collapses while still wearing the crown they had bestowed upon him. Peachy is crucified but after surviving the ordeal for 24 hours, the natives decide the gods do not want him to die and they release him. He then made his way back to Britain.
Kipling is utterly stunned by the story. Peachy leaves his office after telling his tale, but leaves behind a package for Kipling. When unwrapped, Kipling finds Daniel’s skull still wearing the crown of Kafiristan.