Kai Opaka, Bajor's spiritual leader, pays a surprise visit to the station — her first journey away from her home planet. Sisko, Kira, and Bashir escort her on a tour of the station, and although the Kai seems preoccupied, she expresses her desire to go through the wormhole. Sisko accommodates her request, and she travels with the three officers in the Yangtzee Kiang, through the spectacular anomaly and into the Gamma Quadrant. However, though she acts impressed, she still seems distant. But, as they prepare to return, Kira suddenly picks up a narrow band subspace signal. Despite the unknown origin, Opaka encourages Sisko to investigate. They discover a small, meteor-pocked moon, around which orbits a network of artificial satellites, one of which fires an energy blast at the Runabout, severely disabling the vessel. The Yangtzee Kiang crashes violently on the moon's surface. Sisko, Bashir, and Kira free themselves from the wreckage, pulling out Opaka's limp body. Bashir works to revive her, but with no success. The Kai is dead. Before they can absorb the impact of this tragedy, a group of battle-scarred humanoids brandishing weapons appears, capturing the officers.

While Dax and O'Brien prepare to leave the station in search of the senior officers, Sisko, Kira, and Bashir are taken into a large cave, where the leader of the group, Golin Shel-la, explains that he and his people, the Ennis, are suspicious of strangers, because they are at war with a brutal enemy, the Nol-Ennis. He explains that both sides in this war are kept prisoner on the moon by the orbiting satellites, and that he fears his enemy will assume that Sisko's group, by their mere presence in the Ennis camp, has allied with Shel-la. They have no doctors, but many wounded, to whom Bashir gives assistance, as well as to an injured Kira, who is still suffering from the loss of the heart and soul of her home planet. Suddenly, the sound of weapons fire — three Nol-Ennis, with their leader, Zlangco, make a surprise attack on the camp, killing Shel-la and other Ennis. Kira leaps into the fray, using a phaser to bring down part of the cave ceiling on the attackers, causing Zlangco to retreat. The officers barely have time to check the dead and wounded when a silhouette appears in the cave entrance. It is Kai Opaka — come back to life!

Bashir examines Opaka, who is just beginning to grasp her situation. The doctor determines that her physiology has been radically altered, and that there is some kind of bio-mechanical presence on the cellular level controlling her metabolic processes. Then, amazingly, Shel-la and the other dead Ennis begin to stir. They are coming back to life. Bashir finds that their bodies have gone through the same type of alterations as Opaka's. Sisko learns from Shel-la that the Ennis and the Nol-Ennis had been fighting the war for untold generations on their home planet, and when their world's mediators could not arbitrate a cease-fire, the two sides were banished to the moon. As part of the punishment, they have been condemned to fight for eternity — they can never truly die. Sisko suggests a resolution — once his group is rescued, he will transport both sides away from the moon in order to end the battle, and he convinces Shel-la to attempt a truce with Zlangco.

In the Gamma Quadrant, Dax and O'Brien search for the officers in a Runabout, frustrated at the lack of clues. O'Brien then comes up with a way to detect the specific magnetic resonance patterns that Sisko's vessel emits, and tries to create a device to perform that function. Meanwhile, at the Runabout crash site, Sisko meets with Zlangco, who has agreed to listen to his proposal. But Zlangco is very distrusting, and once Shel-la states that he would never allow one Nol-Ennis to leave the moon alive, another battle between the two groups begins — and this time, Sisko is in the middle. Just as he is about to receive a potential death blow, Bashir knocks him to the ground. The doctor has discovered from the Runabout's computer that they cannot afford to die here — not even once.

O'Brien's plan has worked. He and Dax have located the moon. Wisely avoiding the satellites, they try to get a communication through the defense-net. On the surface, Bashir explains that artificial microbes restore a person's body after death, but that body then becomes permanently dependent on those microbes for all cellular functions. The worst part is, anyone with these microbes would die if taken away from the moon — including Kai Opaka. Then, Dax and O'Brien make contact with Sisko, but they can't beam up anyone until they figure out how to get a transporter signal through the net. While they work on that, Sisko and Bashir return to the cave to tell Opaka and Kira the truth about the Kai's condition. But she has already decided to stay on the moon. Here, she has found the answer to all the prophecies of her life — to teach people who know only how to die, how to now live. O'Brien then signals that he has a way to divert one of the satellites, and he can beam up the officers within minutes. Sisko tells the returning Shel-la that the Ennis cannot leave the moon, but Bashir suggests he can disable the program in the microbes, which would allow them to finally die when their time comes. But Shel-la unfortunately sees this as the ultimate opportunity to finally wipe out the Nol-Ennis for good. Stunned, realizing there is no hope, Sisko, Kira, and Bashir beam up when O'Brien signals ready, leaving Shel-la to lunge into another battle, and Kai Opaka remaining as their only hope for peace in an endless war.