The Enterprise warps into the Neutral Zone to help its sister ship, the Yamato, which has been having strange systems failures. Picard contacts Capt. Varley, who thinks the problems are symptoms of a design flaw, and says he's in the Zone because he's found Iconia. Unfortunately, just then, the Yamato inexplicably explodes-and a Romulan ship decloaks.

The Romulan commander demands an explanation for the Enterprise's presence in the Neutral Zone, but Picard says only that they will leave once they are convinced the Romulans were not responsible for the Yamato's destruction. Upon downloading and examining the Yamato's logs, Geordi becomes convinced it was not the Romulans, but they decide to sit right where they are, just in case it is a design flaw. Picard examines Varley's personal logs, and finds Varley obsessed with getting to Iconia, a legendary planet of vast technological achievement, before the Romulans do. He decides to travel to Iconia (or, at least, what Varley believed to be Iconia) himself, despite it being further in the Zone, and despite strange malfunctions that begin to occur on the Enterprise.

Upon arriving at Iconia, they are approached by a probe similar to one that scanned the Yamato, but manage to destroy it before it can scan them. Geordi deduces that an alien computer program from the probe is what destroyed the Yamato, and Picard, Data, and Worf beam down to the apparently long-dead Iconia to look for anything that could help them solve their own problems. You see, in taking the Yamato logs, they also took the program, so it's gradually spreading.

Back in space, the Romulan vessel appears again. As Riker calls for red alert, shields and weapons start failing at random. The ship is helpless, but suddenly it becomes clear that the same thing is happening to the Romulan ship. Picard, meanwhile, finds a control center, and Data accidentally activates the Iconian equivalent of a transporter, which can go anywhere. Picard, not willing to risk Iconia falling into Romulan hands, decides to destroy the installation-but then Data is taken over by the program himself.

Picard orders Worf to take Data back the next time the image switches to the Enterprise (which it's already done before), and quickly asks Data how to destroy the installation. Data, badly damaged, manages to tell Picard how to do this, then he and Worf leave. Data, in Engineering, completely shuts down, then revives, intact except for a slight memory loss. Geordi realizes that a complete shutdown and wipe of affected memory will "cure" the Enterprise, and does that. Picard, meanwhile, triggers the destruct and runs through the gate, where he finds himself smack aboard the Romulan ship, where the auto-destruct has engaged itself. The Enterprise beams Picard back, and Riker and Geordi tell Taris how to save her ship, as the Enterprise warps away.