Sisko, Odo, and Dax prepare for the arrival of a team of Cardassian scientists who plan to deploy a subspace relay to allow communication through the Bajoran wormhole to the Gamma Quadrant for the first time. Vedek Yarka arrives to tell Commander Sisko that a Bajoran prophecy, Trakor's Third, warns that this situation would bring catastrophe. A river on Bajor being diverted and the fact that the station was Cardassian all fall into his interpretation of this prophecy, along with the scientists being "three vipers" attempting to "peer into the temple gates" as their relay being put in operation. Yarka is treated with skepticism after he admits that he is the only vedek that interprets the prophecy in this manner, especially when it is learned that there are only two scientists not three.
The scientists arrive and debrief the station crew about the experiment. They explain that there will be another scientist that will arrive later. This information startles Kira who begins to wonder about the prophecy. Yarka confronts Kira about her faith and her duty to help Sisko, while O'Brien and Dax get to know the two scientists, Ulani and Gilora. The third scientist, Dejar, arrives and is clearly not appreciated by the first two. While O'Brien and Gilora work on the station (complicated by the fact that Gilora misinterprets O'Brien's hostility towards her as a romantic overture, as in Cardassian tradition), Sisko takes Ulani through the wormhole to set up the relay itself. They discover a comet ("a sword of stars will appear in the heavens"), and Kira is further convinced that it is part of the prophecy. Sisko confronts her and she explains her feelings on the matter, including the fact she believes he is the Emissary, who, according to the prophecy, is destined to be an essential part of the situation.
The relay is deployed and the test begins. A particular carrier wave somehow activates the wormhole and causes its gravity well to increase. This causes the comet to change course and head towards the wormhole. They discover that an element in the core of the comet will cause a reaction if it enters the wormhole and destroy it forever. The crew comes up with a solution to destroy the comet by altering the Defiant's phasers to generate a wider beam than normal in order to vaporize the comet evenly.
Sisko, despite starting to believe in the prophecy, goes ahead with the plan. They attempt to destroy the comet but the phasers fire a standard burst which breaks the comet into fragments. Dax explains that the modified phasers never came online. O'Brien thinks he made a mistake, but Gilora accuses Dejar of sabotage, saying it wasn't O'Brien's fault. It is revealed that Dejar is part of the Cardassians' intelligence agency—the Obsidian Order—and was placed there to sabotage the mission. One of the scientists suggests creating a subspace field around the fragments to isolate the silithium as it goes through the wormhole. The plan nearly works, but some of it leaks out and reacts with the wormhole. However, this turns out to be unexpectedly beneficial. A subspace filament forms along the entire length of the wormhole, establishing the communications link. Kira and Sisko realize that the entire prophecy actually came true. The three vipers were the three comet fragments and the silithium ignited the wormhole, "burning the temple gates"—so they'd never close again.