In this episode, Picard and company try to protect the Enterprise against a catastrophic malfunction and simultaneously unlock the secrets of the once-powerful Iconian empire while keeping those secrets from the watchful Romulans.
Aboard the Federation starship Enterprise, Captain Jean-Luc Picard is contacted by his friend Captain Donald Varley of the USS Yamato. Varley, an archeology buff like Picard, believes he has found the fabled planet of Iconia at a location within the Romulan Neutral Zone. Varley believes that the extinct Iconians had developed extremely advanced technology, and that the Romulans might be attempting to acquire this technology for use against the Federation. However, as the Yamato neared the purported planet the ship began to experience system failures and is now stranded in the Neutral Zone. After receiving a distress signal the Enterprise intercepts the Yamato to assist in repairs. As the two ships meet, the Yamato suffers a warp-core breach and is destroyed with no survivors. Shortly after the destruction of the Yamato a Romulan Warbird, the Haakona, decloaks before the Enterprise and demands their retreat from the Neutral Zone. Picard informs the Romulans that they will not leave until they have determined why the Yamato was destroyed. He then orders the Enterprise to the same planet that the Yamato had surveyed.
When they enter the planet's orbit, a probe is automatically launched from the surface. Having reviewed the Yamato's logs, Chief Engineer La Forge recognizes that the probe carries a computer virus that led to the Yamato's destruction. He insists that they destroy the probe before the virus can be unleashed. However, a portion of the virus exists in the Yamato logs and infects the ship. Although presently contained, the virus still threatens to destroy the Enterprise in the same manner. Picard, Lt. Commander Data, and Lt. Worf beam to the source of the probe launch to try to find how to stop the virus. While exploring the ruins, they find a teleportation portal that appears to allow for instantaneous interstellar travel to a different location that changes every few seconds. Among the destinations are the Enterprise and Haakona bridges. The android Data attempts to access the Iconian computer systems and becomes infected with the virus himself, but retains enough of his functions to instruct Picard on how to destroy the base.
The away team learns that the virus has affected the Enterprise transport systems and they cannot be beamed back. Furthermore, the Haakona has decloaked in orbit, but appears to be suffering from similar failures. Picard orders Worf to return with Data through the Iconian gate to the Enterprise, while he starts the destruct sequence. He uses the gate to jump onto the Haakona's bridge, and discovers that their ship is set on an auto-destruct sequence they cannot stop due to the virus.
On the Enterprise, Data's systems are nearly overtaken by the virus. His body automatically shuts down as a protective measure, and then restarts a short time later. La Forge finds Data's systems to now be completely free of the virus, and suggests a similar cold boot to clear the virus from the Enterprise. With the transporters back online, Picard is beamed off the Haakona, and Commander Riker sends instructions to the Romulans on how to clear the virus. The Romulans successfully restart their computers, and both ships peacefully leave the Neutral Zone as the Iconian base can be seen destroying itself on the surface of the planet.