To keep Pippin out of further trouble, Gandalf rides with him to Minas Tirith, the city that Sauron's armies will soon besiege. They meet with Boromir's father Denethor, the Ruling Steward of Gondor, and in gratitude for Boromir's sacrifice (saving them from the orcs at Parth Galen), Pippin pledges his service to the steward as a Guard of the White Tower. Denethor does not trust Gandalf, and he knows that the wizard has brought Aragorn to reclaim the throne. Faramir returns to the city, wearied from fighting, and reports his encounter with Frodo. Angry that his son did not bring the Ring to Gondor, Denethor sends the exhausted captain back into the field to lead a rearguard action against the oncoming army. When they make their last dash for the safety of the gates, Gandalf rides out to defend them from the flying Nazgûl, but Faramir falls at the gates.
The Riders of Rohan muster their forces, preparing to ride to the aid of Minas Tirith, and Merry strikes up a friendship with Théoden. Aragorn realizes that he must take the Paths of the Dead if he is to reach Minas Tirith in time to lift the siege. He takes the evil road with Legolas, Gimli, and the Dúnedain (a group of Rangers) who have joined him from the North, but the Rohirrim are convinced that he has gone to his own death. Théoden leaves behind Merry and his niece Éowyn, claiming that neither can help in the battle, but a young rider offers to carry Merry. With the aid of a strange tribesman, the Rohirrim find a forgotten road and arrive just in time to surprise the besieging army at Minas Tirith.
Although small in number, the Riders of Rohan sweep across the battlefield. Then the Witchking (the most powerful Nazgûl) kills Théoden, and their charge is stopped. The rider who brought Merry to the battle reveals herself as Éowyn, and with Merry's help she slays the Enemy's greatest servant. The hopes of the city are dashed when a fleet of dark ships appears on the river, but the lead ship unfurls a banner bearing the insignia of the True King: Aragorn has arrived from the Paths of the Dead. He used his authority as the True King to call the dead themselves into battle, and they destroyed a second army that had been approaching from the river.
Inside the city, Denethor descends into madness as he watches the plight of his city and the deadly illness of Faramir. Convinced that all is lost, he orders Faramir's body carried into the mausoleum, where he plans to burn himself and his son alive. Pippin manages to find Gandalf, who saves Faramir from his father's madness, but Gandalf cannot prevent Denethor's own suicide. Faramir is taken to the Houses of Healing, as are Éowyn and Merry, and Aragorn enters the city to tend to their illness. The ability to heal is a sign of the True King, and Ioreth, one of the women in the House, recognizes Aragorn's right to the throne.
Although the battle for Minas Tirith has been won, the only true victory lies with Frodo's quest. To distract Sauron from any attempt to reach Mount Doom, Aragorn leads the remaining armies of the West to the Black Gate. When they arrive, a herald from Mordor shows them Frodo's mailshirt in an attempt to make them lose heart, but the attempt at misdirection shows them that Sauron does not yet have the Ring. An enormous army attacks, and Aragorn's armies are slowly overwhelmed.
Back in Shelob's tunnel, after taking the Ring, Sam hears a party of orcs approaching and hides from them. They find Frodo's body, and Sam learns from their conversation that Frodo is only unconscious, not dead. He rescues Frodo from the orc tower, and they begin the final stage of the journey across the desert wasteland of Mordor itself. They move slowly, hampered by thirst and the almost unbearable burden of the Ring itself, not to mention the necessity of avoiding the armies of orcs swarming the countryside. After a long struggle, they reach the slopes of Mount Doom. Gollum reappears and attacks Frodo, finally realizing that the goal of the quest has been to destroy his precious Ring. Sam holds him off long enough for Frodo to reach the Cracks of Doom. When the time comes to actually give up the Ring, Frodo cannot do it. Instead, he claims it for his own and puts it on. Instantly, Sauron sees what has happened and sends all of his power toward the mountain, including the remaining Nazgûl. Gollum is faster, however, and he struggles with Frodo on the edge of the pit. When he wrests the Ring from Frodo's hand, Gollum dances for joy and accidentally falls into the volcano, inadvertently achieving what Frodo could not do intentionally.
Frodo and Sam are rescued by the giant eagles from the slopes of the mountain, and Aragorn himself tends their injuries. The world hails them as heroes for destroying the Ring and Sauron. Aragorn takes the throne of Gondor and marries Arwen, the daughter of Elrond. Eventually, the hobbits return home to the Shire. When they arrive, they find that the country is not the green and peaceful land they remember. A form of martial government has been instituted, and many people have been thrown into prison while others have cut down trees and polluted the countryside. Merry, Pippin, and Sam lead a revolt to reclaim the Shire, and they learn that the cause of this devastation is Saruman. Released by Treebeard, the former wizard has exacted his revenge by bringing the war home to the hobbits.
Despite the ravages of Saruman's rule, the hobbits manage to restore the Shire to its former glory. Merry, Pippin, and Sam become prominent citizens, but Frodo remains detached and saddened, permanently damaged by his experiences with the Ring. Several years after his return home, he takes a final journey. Joining Elrond, Galadriel, Gandalf, and even Bilbo, Frodo sails with the elves to the Undying Lands, having saved the Shire for others but unable to stay there himself. Sam returns to his family in the Shire, saddened by Frodo's departure but happy with the life he has made for himself.