Captain Nathan Algren is a bitter alcoholic; bitter, because of the things that he witnessed during the American Indian war and an alcoholic because he wants to forget his experiences there and drink is the only thing that enables him to do so. He is approached by his former commanding officer, Colonely Begley, who offers him the chance to train the new Japanese Imperial Army that has been formed by a wealthy Japanese businessman named Omura with the express purpose of putting down Samurai rebellion against Japan's new young Emperor. Algren despises Begley but he needs the money and accepts the post.
Algren heads to Tokyo with his friend, Seargean Zebulon Gant, and they are met by a British interpreter, Simon Graham, when they arrive. They are also met by a surprise; the "soldiers" that they are to train are actually peasants conscripted from the fields, with no knowledge of war, strategy or weaponry. Early into their training they are summoned to one of Omura's railroads where the Samurai are on attack. Despite Algren's protestations that his army are not ready, Omura is insistent and the battle that ensues is a predictable disaster. The soldiers are routed, Gant is killed and Algren is surrounded. He expects the Samurai to kill him but they don't; instead, he is taken to the home village of their leader, Katsumoto, where he is kept amongst Katsumoto's family. The men gradually come to respect each other and an unlikely friendship is formed. Algren works through the issues that have caused his alcoholism and he also learns Japanese language and culture.
When a group of ninjas invades the village at night, with the intention of assassinating Katsumoto, Algren defends the village and saves Katsumoto's life. Katsumoto requests, and is granted, an audience with the Emperor and takes Algren to Tokyo with him. Both men receive a shock when they arrive; Algren is shocked that the Imperial Army is now a well equipped fighting force to be reckoned with, and Katsumoto is shocked to find that the Emperor he thought he hated is little more than a boy, with no experience at all. He is a puppet in the hands of Omura. Omura is present at their meeting and immediately orders the arrest of Katsumoto for carrying a sword in public. He tells the Samurai that he should commit Seppuku - the cutting of the abdomen - to redeem his honor. He also offers Algren the job of leading the army to crush the rebels, but Algren turns him down.
Omura is furious that Algren refused his offer and send assassins to kill him, but Algren kills them first. He then works with the Samurai to free Katsumoto from his imprisonment, but this is not without casualty, as in the ensuing fight Katsumoto's own son, Nobutada, is killed.
The Imperial Army marches on the Samurai rebels, and Algren joins the Samurai in the battle. The Imperial Army are well-equipped but over confident, and the Samurai are able to use this against them. They lure them into a trap and cut off their artillery support. The battle is devastating to both sides but the army are pushed back. Katsumoto knows that this is only temporary and once reinforcements are sent, they will be outnumbered. He orders a charge on horseback, which is suicidal, but does succeed in taking out more of the Imperial Army. Algren kills Begley when his line is broken through by the Samurai , but the army's Gatling guns are too much for them and they are slaughtered. The Imperial captain who was trained by Algren is so horrified by the sight of so much death around him that he orders a ceasefire, against the express instructions of Omura. Katsumoto commits Seppuku with Algren's assistance.
Algren is badly injured too, but this does not prevent him from interrupting the trade talks between Omura and the Emperor, and representatives of the West. He presents the Emperor with Katsumoto's sword and asks him to remember the traditions of the country that his Samurai died for. The Emperor comes to realize that although he wants Japan to modernize, this cannot be at the expense of old traditions and the country's history. He declines the trade deal and will not listen to Omura's protests. Omura is quieted when the Emperor threatens to strip his family of their assets and distribute them amongst the people of Tokyo.
Nobody knows what becomes of Algren after that. Simon Graham's best guess is that he returned to Katsumoto's village, where he settled back into his relationship with Taka, the widow of a Samurai he had killed in battle.