Captain Jean-Luc Picard wakes from a nightmare in which he relived his assimilation by the cybernetic Borg six years earlier (shown in the television episode "The Best of Both Worlds"). Starfleet informs him of a new Borg attack against Earth, but orders the USS Enterprise-E to patrol the Romulan Neutral Zone so as not to introduce an "unstable element" to the fight. Learning that the fleet is losing the battle, the Enterprise crew disobeys orders and heads for Earth, where a single, damaged Borg Cube opposes a group of Starfleet vessels. The Enterprise arrives in time to save the crew of the USS Defiant, which is being commanded by Lieutenant Commander Worf. After Picard hears Borg communications in his mind, he orders the fleet to concentrate its firepower on a seemingly non-vital section of the Borg ship. The Cube is destroyed after launching a smaller sphere ship towards the planet.
The Borg sphere generates and enters a temporal vortex. As the Enterprise is enveloped in the vortex, the crew briefly glimpses an Earth populated entirely by Borg. Picard realizes that the Borg have used time travel to change history, and orders the Enterprise to follow. The Enterprise arrives in the past, on April 4, 2063, the day before humanity's first encounter with alien life after Zefram Cochrane's historic warp flight. The Borg sphere fires on the planet; the Enterprise crew then destroy the sphere and, realizing that the Borg were trying to prevent first contact, send an away team to the Montana missile complex where Cochrane is building his ship, the Phoenix, to look for survivors. Picard sends Cochrane's assistant Lily Sloane to the Enterprise for medical attention, then returns to the ship and leaves Commander William Riker on Earth to make sure the Phoenix's flight proceeds as planned. The Enterprise crew sees Cochrane as a legend, but the real man is reluctant to assume his historical role.
Borg survivors invade the Enterprise, and begin to assimilate its crew and modify the ship, planning to use it to attack and conquer Earth. Picard and a team attempt to reach engineering to disable the Borg with corrosive coolant used in the warp core, but the android Data is captured and meets the queen of the Borg Collective, who gains his trust by giving part of him human skin. A frightened Sloane seizes the captain but he gains her trust, and they escape the Borg-infested area of the ship by using the holodeck. Picard, Worf, and the ship's navigator, Lieutenant Hawk, stop the Borg from calling reinforcements with the deflector dish, but Hawk is assimilated. As the Borg continue to assimilate, Worf suggests destroying the ship, but Picard angrily calls him a coward and vows to continue the fight. Sloane confronts the captain and, reminding him of Moby-Dick's Captain Ahab, makes him realize his own irrational behavior. Picard activates the ship's self-destruct mechanism, orders the crew to abandon ship, and then apologizes to Worf. While the crew heads to escape pods, Picard remains aboard to rescue Data.
As Cochrane, Riker, and engineer Geordi La Forge prepare to activate the warp drive on the Phoenix, Picard confronts the Borg Queen and discovers she has grafted human skin onto Data, giving him an array of new sensations. She has presented this modification as a gift to the android, hoping to obtain his encryption codes to the Enterprise computer. Although Picard offers himself in Data's place, the android refuses to leave. He deactivates the self-destruct sequence and fires torpedoes at the Phoenix, but they miss and the Queen realizes Data has betrayed her. Data ruptures a coolant tank, and the corrosive substance fatally dissolves the Borg's biological components. Cochrane completes his warp flight, and that night, April 5, 2063, the crew watches as Vulcans, attracted by the Phoenix warp flight, land and greet Cochrane. Having repaired history, the Enterprise crew returns to the 24th century.
Output: The events of the story act as a sequel to which episode?