Duty, Honor, Victory, Redemption

The opening crawl reveals that the Galactic Empire has been working on the construction of a new armored space station which is to be even larger and more powerful than the first Death Star. Jedi Knight Luke Skywalker, Chewbacca, Lando Calrissian, Princess Leia Organa, C-3PO, and R2-D2 return to Tatooine in an attempt to rescue Han Solo from the gangster Jabba the Hutt. Leia, disguised as a bounty hunter, attempts to secretly free Solo, who is still encased in carbonite. She succeeds, only to be discovered and captured by Jabba, who makes her his personal slave. Several days later Luke arrives to make one final plea to Jabba to release Solo. Luke is then captured by Jabba's guards and dropped into a dungeon to battle a rancor. After defeating the rancor he is sent along with Han Solo and Chewbacca to the Great Pit of Carkoon to be slowly consumed by the Sarlacc. With the help of R2-D2, Luke escapes and a large battle erupts; during the chaos, Leia strangles Jabba to death with her slave chains, and Han accidentally knocks Boba Fett, the bounty hunter who brought him to Jabba, into the pit where he is eaten alive by the Sarlacc. Following this, Luke blasts Jabba's sail barge with its own deck cannon, and all of the heroes manage to escape before it explodes. 
Luke then returns to Dagobah to complete his Jedi training. However, upon arriving, he finds Yoda is languishing. Yoda tells Luke that no other training is required, but that he will not truly be a Jedi until he confronts Darth Vader who, Yoda confirms, is Luke's father. Yoda then dies, but not before telling Luke that "there is another Skywalker". The spirit form of Obi-Wan Kenobi then appears and confirms that Vader was once Anakin Skywalker, a former Jedi who was turned to the dark side of the Force. Though he initially seemed to imply that Vader was merely another Jedi who betrayed and murdered Anakin, Obi-Wan explains that Vader truly did this in the sense of the dark side consuming Anakin's mind, apparently destroying the good man who was Luke's father and replacing him as Vader. Luke asks Obi-Wan about the "other" Skywalker Yoda mentioned—Obi-Wan reveals that this "other" is his twin sister, hidden from Anakin and separated at birth to protect them both from the Emperor. Using his intuition, Luke quickly deduces that, to Obi-Wan's confirmation, his sister is Leia. 
Meanwhile, the entire Rebel Alliance is meeting to devise an attack strategy. As part of the attack, Han is elected to lead a strike team to deactivate the shield generator on the forest moon of Endor which is projecting a protective shield up to the orbiting and incomplete Death Star. Luke, having returned from Dagobah, joins him and Leia for this mission; however, he soon fears that, after sensing Vader's presence within the nearby Imperial Fleet, his own presence may endanger the mission. On Endor, Luke and his companions encounter a tribe of Ewoks, primitive yet intelligent indigenous forest creatures of Endor. With the help of C-3PO, whom the Ewoks believe is a god, they are able to forge an alliance with the forest creatures. Later, Luke decides that the time has come for him to face Vader. He confesses to Leia the truth about her and Vader, and that he has to try to save the man who was once their father. He surrenders peacefully to Vader and unsuccessfully tries to convince his father to abandon the dark side. They go to the Death Star and meet the Emperor, who reveals that he knew of the attack before, and that the Rebel Alliance is walking into a trap. On the forest moon, the Rebels – led by Solo and Leia – enter the shield generator control facility only to be taken prisoner by waiting Imperial forces. Once they are led out of the bunker, however, the Ewoks spring a surprise counterattack. A desperate ground battle begins with the Rebels and Ewoks fighting the Imperial forces. The Rebels eventually gain the upper hand, due in large part to a stolen Imperial AT-ST Walker. 
During the strike team's assault, the Rebel fleet, led by Lando, emerges from hyperspace for the battle over Endor, only to discover that the shield of the Death Star is still functioning. An intense space battle takes place as the Rebel fleet battles to give the surface party more time to complete their mission of deactivating the Death Star's shield. During the battle, the Death Star is revealed to be operational; its superlaser is fired at the Rebel fleet and obliterates two Rebel star cruisers. This forces a rethinking of strategy and the fleet closes with the Imperial star destroyers to prevent the superlaser from firing on the Rebel fleet. 
On the Death Star, the Emperor tempts Luke to give in to his anger. A ferocious lightsaber duel erupts between Luke and his father. In the midst of combat, Vader reads Luke's feelings and learns that Luke has a twin sister. When Vader toys with the notion of turning Leia to the dark side, Luke gives in to his anger and brutally overpowers his father, eventually slicing off Vader's robotic right hand. However, despite the Emperor's goading, Luke refuses to kill his father, realizing that he is traveling down his father's path towards the dark side. He declares himself a Jedi, like his father before him. Upon realizing that Luke cannot be turned, the Emperor tortures and slowly kills him with Force lightning; in unspeakable pain, Luke begs his father for help. Facing a moral crisis as he sees his son dying before his own eyes, Vader finally repents in return of his former self, Anakin Skywalker, and turns on the Emperor, grabbing him over his shoulder and throwing him down a reactor shaft to his death. At the same time, however, the life support system in his suit is damaged beyond repair by the Emperor's lightning. Moments from death, he begs Luke to take off his breath mask to see him with his own eyes. Luke does so, and finally sees his father's true face: that of a pale, withered man ravaged by the dark side. He entreats Luke to leave him and save himself, and to tell Leia that there was some good left in him after all. With those last words, Darth Vader/Anakin Skywalker dies, finally at peace. 
Back on Endor, the strike team finally destroys the shield generator. The Rebel fleet seizes the opportunity to launch a final assault on the Death Star in space. Lando leads Wedge Antilles and his fighter group into the interior of the Death Star and they fire at the main reactor, causing its collapse. Luke escapes the Death Star with his father's body in an Imperial shuttle. Moments later, Wedge in his X-Wing and Lando in the Millennium Falcon emerge from the Death Star as well, just as it explodes. Back on Endor, Leia senses that Luke had escaped the station before it exploded. Han believes that she loves Luke and is prepared to let her go, but Leia reassures Han of her love for him and reveals (to his surprise and relief) that Luke is actually her brother. That evening, Luke cremates the remains of his father in his black armor on a funeral pyre on Endor. 
The entire galaxy celebrates the fall of the Empire and the Rebellion's victory. On Endor, Luke, Leia, Han, Lando, and the rest of the Rebellion, along with the Ewoks, celebrate the victory as well. During the celebration, Luke catches sight of the spirit figures of Obi-Wan Kenobi, Yoda and the redeemed Anakin Skywalker, who watch over them with pride.
The film opens with a female Vulcan, Lieutenant Saavik, in command of the starship USS Enterprise. The vessel is on a rescue mission to save the crew of a damaged ship in the Neutral Zone along the border with Klingon space. The Enterprise is attacked by Klingon cruisers and critically damaged. This "attack" is revealed to be a training exercise known as the "Kobayashi Maru"; a no-win situation designed to test the character of Starfleet officers. Admiral James T. Kirk oversees the simulator session of Captain Spock's trainees. 
The USS Reliant is on a mission to search for a lifeless planet for testing of the Genesis Device, a torpedo that reorganizes molecular matter to create hospitable worlds for colonization. Reliant officers Pavel Chekov and Clark Terrell transport down to the surface of a possible candidate planet, Ceti Alpha VI, where they are captured by Khan Noonien Singh. Khan and his fellow genetically-advanced supermen were once rulers on Earth in the late 20th century, but after their defeat they were exiled to space in a sleeper ship. The Enterprise discovered Khan's ship adrift in space fifteen years previously; James Kirk exiled Khan and his followers to Ceti Alpha V after the supermen nearly captured the Enterprise. Khan reveals that after they were marooned, Ceti Alpha VI exploded, destroying Ceti Alpha V's ecosystem and shifting its orbit; Chekov and Terrell have unwittingly landed on Ceti Alpha V. Khan blames Kirk for the deaths of his wife and followers, and plans to avenge them. He implants Chekov and Terrell with indigenous, mind-controlling eels that enter the ears of their victims, and uses the officers to gain control of the Reliant. 
The Enterprise embarks on a training voyage under the command of Spock. Kirk, conducting an inspection of the Enterprise, receives a garbled message from Space Station Regula I, a remote science laboratory where Kirk's former lover, Dr. Carol Marcus, and their son, Dr. David Marcus, have been developing the Genesis Device. The Enterprise is ordered to investigate and Kirk assumes command of the vessel. Khan uses a surprise attack to cripple the Enterprise en route, killing many of the ship's trainees. A transmission between the two ships reveals Khan knows of the Genesis Device and wants all materials related to the project sent to him. Kirk stalls for time and disables the Reliant's defenses by transmitting a prefix code. With his ship badly damaged, Khan is forced to retreat and make repairs. 
The Enterprise arrives at Regula I, where they find members of the Genesis team dead. The remaining scientists, including Carol and David, have hidden deep inside the planetoid of Regula. Using Terrell and Chekov as spies, Khan steals the Genesis Device. When Terrell is ordered to kill Kirk, the eels' influence wanes; Terrell kills himself while Chekov overcomes the parasite's control. Though Khan believes he is leaving Kirk stranded on Regula I, Kirk and Spock use a coded message to arrange a rendezvous and pilot the Enterprise into the nearby Mutara nebula. Static discharges from the nebula renders ships' defensive shields useless and compromises targeting systems, making the Enterprise and Reliant evenly matched. Khan pursues his quarry against his lieutenant's advice. 
Inside the nebula, Kirk uses Khan's inexperience in three-dimensional combat to critically disable the Reliant. Mortally wounded, Khan activates the Genesis Device, which will reorganize all matter in the nebula—including the Enterprise. Though Kirk's crew detects the activation of the Genesis Device and begins to lumber away using impulse engines, with the warp drive damaged they will not be able to escape the nebula in time. Spock goes to the ship's Engineering section to restore warp drive. When McCoy tries to prevent Spock's exposing himself to high levels of radiation, he disables the doctor and tells him to "remember". Spock restores power to the ship, allowing the Enterprise to escape the explosion. Kirk arrives in Engineering just before Spock dies of radiation poisoning. 
The explosion of the Genesis Device causes a planet to coalesce out of the nebula. A space burial is held in the Enterprise's torpedo room, and Spock's coffin is shot into orbit around the newly formed planet. Kirk and David make peace, and the crew leaves the planet to pick up the Reliant's marooned crew. In the final scene Spock's coffin is seen to have soft-landed on the planet. Spock narrates Star Trek's "Where no man has gone before" monologue as the camera pans forward into a field of stars. 
The USS Enterprise limps back to Earth heavily damaged after a battle with Khan Noonien Singh (see Star Trek II: The Wrath of Khan). Many were lost in the costly fight, including Admiral James T. Kirk's Vulcan friend, Spock; Spock's casket was shot into orbit around the newly-formed Genesis Planet, created by a torpedo designed to create life from lifelessness. On docking, the Enterprise' crew learns that the ship is due to be decommissioned. Dr. Leonard McCoy is confined by security after he begins to exhibit strange behavior. David and Lieutenant Saavik return to Genesis aboard the research vessel USS Grissom; discovering an unidentified lifeform, Marcus and Saavik beam down to the planet and discover that Spock has been resurrected by the Genesis Device's effects, although his mind is no longer present and he operates on a purely child-like level. Marcus, pressed by Saavik, admits that he used unstable "Proto-matter" in building the Genesis device to solve "certain problems". Without it, he claims that the Genesis Project could have been delayed by years or would have never been completed at all. The unstable matter puts the planet in a state of accelerated evolution that will conclude with its premature destruction within a few hours. 
Unknown to them, a Klingon commander named Kruge has intercepted information about Genesis and becomes interested in it (for much of the same reasons as Khan: as a weapon). He travels to the Genesis Planet to learn its secrets after stealing additional information related to it. 
Spock's father, Sarek travels to Earth and confronts Kirk about abandoning Spock's body on the Genesis planet. Sarek discovers, with Kirk's help, that McCoy possesses Spock's "katra" (soul), which explains his strange behavior. Both his katra and body are needed to properly lay him to rest on his homeworld Vulcan; without swift intervention, Spock's consciousness will overwhelm McCoy, and he will also die. Disobeying direct orders prohibiting anyone from visiting the Genesis Planet, Kirk reunites with his bridge officers and goes through a series of highly unorthodox events such as Uhura charming the watch officer (locking him in a closet), Kirk and Sulu springing McCoy from the Starfleet jail, and Scotty overriding the Starbase security system to open the Starbase doors so the Enterprise can escape, and secondly disabling the pursuing USS Excelsior's "transwarp drive", by removing several circuits. 
Kruge arrives at Genesis first, accidentally destroying the Grissom with all hands (save for the landing party). He then summarily executes his weapons officer responsible for the Grissom's destruction as Kruge wanted prisoners. His crew locates and captures the scientists on the planet: David, Saavik, and a now-teenaged Spock. Kirk and the skeleton crew of the Enterprise arrive, unaware that the Klingon ship and its crew are cloaked nearby. Unable to hail the Grissom, the Enterprise crew suspects the presence of a Bird of Prey and are able to strike first, hitting the Klingon ship as it de-cloaks. The Klingon ship returns fire and cripples the automation system controlling the Enterprise. Kruge demands that they surrender, and orders the troops that he had sent to the surface of the Genesis Planet to kill one of the prisoners as a show of strength. David defends Saavik, who was to be the intended victim. David briefly tussles with the Klingon, but is no match with him physically and dies as a result. Kirk is devastated to hear his son has been killed. 
Rather than surrender, Kirk orders McCoy and Sulu to the transporter room. Kirk, Scott and Chekov order the ship to self-destruct, and they leave the Enterprise for the last time. The computer countdown confuses the majority of Kruge's crew who had just beamed over to complete the ship's capture and are all killed as the ship self-destructs. The crew of the Enterprise watch from the planet's surface as their home for the last twenty years burns up in the atmosphere. They find Saavik and Spock and free them from their captors. Kirk finds a communcator and tempts Kruge, who is mourning his crew, in an attempt to get him to beam them all up before the planet destroys itself. Moments later, Kruge beams to the planet and has everyone but Kirk and Spock beamed aboard his Bird of Prey. Still demanding the technology of the Genesis project, Kruge engages Kirk in hand-to-hand combat on the disintegrating planet. Kirk tries in vain to get Kruge to cooperate so they can both escape the planet, but Kruge would prefer a fight to the death. Kirk defeats Kruge who subsequently falls into a volcanic rift. Kirk quickly grabs Spock and imitates Kruge's voice shouting the order to beam them both aboard Kruge's ship. The Enterprise crew are able to easily capture the Klingon vessel and the one crewman left on board. 
The crew travel to Vulcan, where Spock's katra is reunited with his body in a dangerous procedure called "Fal-tor-pan". Dr. McCoy agrees to the ritual, knowing the extreme risk for both him and Spock. The ritual is successful and Spock is resurrected alive and well, though his memories are still extremely fragmented. The final scene, a brief discussion between Kirk and Spock, ends with Spock slowly remembering the man before him: "Jim. Your name is Jim." 
A large cylindrical object moves through space heading towards Earth, sending out an indecipherable signal and disabling the power of any vessel or station that it passes. As it takes orbit around Earth, it continues to send out a signal and disrupting the global power system, and then starts causing extreme weather patterns to develop over the planet while evaporating the oceans. Starfleet Command on the last of its power reserves sends out a subspace signal warning of the danger. On Vulcan, the former crew of the USS Enterprise decide to return to Earth to face the punishment for the willful destruction of the ship; Spock, still recovering from being reborn on the Genesis planet, goes with them. The crew uses the seized Klingon Bird of Prey, renamed the HMS Bounty, to return to Earth. As they enter the solar system, they hear Starfleet's warning and the alien signal; Spock is able to determine that it matches the song of humpback whales, long since extinct on Earth, and that the object will continue to wreck havoc on the planet until it can be answered. The crew devices a plan, to slingshot around the Sun to time travel back to the late 20th century and return with a whale. 
The time travel process is completed successfully, placing them in the year 1986, though their dilithium crystals are nearly drained and cannot be used in the current state to return to the future. After cloaking the Bird of Prey and landing it in a San Francisco, California park and adjusting to the time period, the crew splits up; Kirk and Spock to locate a whale, Scotty, Dr. McCoy and Sulu to device a holding tank for the whale, and Uhura and Chekov to search for a nuclear power source to repair the dilithium crystals. Kirk and Spock are able to quickly discover a pair of humpback whales, "George" and "Gracie", at the Cetacean Institute, and are told by the Institute's whale expert, Dr. Gillian Taylor, that the whales are shortly going to be released into the wild, making the pair ideal for their needs. However, to be able to track them, Kirk attempts to woo Dr. Taylor to reveal the tracking codes for the whales. Despite his pleads, she rebuffs him. 
Scotty, McCoy, and Sulu are able to work with materials fabricator to create and acquire "transparent aluminum", a lightweight material that can hold the water needed in the tank aboard the Bounty. While Uhura and Chekov are able to locate the U.S.S. Enterprise, a nuclear-powered aircraft carrier, and draw some of its power to restore the dilithium, but as they do, Chekov is captured, and a resulting escape attempt severally injures him and he is taken to a hospital. McCoy worries for Chekov's health due to the barbaric practices of the current era of medicine, and the crew put together an escape attempt, forcing Kirk to reveal their true intent to Dr. Taylor to pull it off. After they safely recover Chekov, Dr. Taylor reveals that the whales have been released a day early, and coerces Kirk to bring her along so she can help find them. The crew is able to locate the whales before they are hunted by whalers, and transport the creatures aboard. With Dr. Taylor and the whales, the crew reverses the slingshot maneuver and return to the future. 
The Bounty approaches Earth but immediately loses power due to the alien signal. The ship splashes down into the San Francisco bay, and they are able to release the whales from the hold. The whales are able to answer the signal, causing the object to restore Earth to its normal condition and to return to the depths of outer space. Despite their success, the crew is put to trial at Starfleet for several charges, including the destruction of the Enterprise, but in light of their heroic efforts, only the charge of disobeying a superior officer is not waived, with the punishment being the demotion of Kirk from Admiral to Captain, giving him command of a new starship. Though smitten by Kirk, Dr. Taylor takes a position aboard a civilian science vessel, being the only expert on whales in this century. The crew departs to their new vessel, the newly constructed USS Enterprise-A, and depart on another mission.