Meanwhile on Bajor, Dukat, still disguised as a Bajoran, and Kai Winn, who has turned against the Prophets, trek to the fire caves with an ancient book that will release the Pah-wraiths. After she makes them appear around a chasm, Winn poisons Dukat, but he is resurrected by the Pah-wraiths and restored to his Cardassian appearance.
A peace treaty is signed on DS9, and the crew celebrates in Vic's Lounge. However, in the middle of dancing with Kasidy, Sisko suddenly realizes he must go to the fire caves. He arrives and attacks Dukat, but is subdued by Dukat's new godlike powers. Winn tells Sisko to destroy the book, and Dukat kills her. Sisko topples Dukat and they and the book fall into the fiery chasm. Suddenly finding himself in the Celestial Temple, Sisko is told by Sarah that his task is complete, and it is time for him to rest with the Prophets. The DS9 crew is puzzled by Sisko's disappearance until he comes to Kasidy in a vision, telling her that he has moved on to a new stage of his life. He assures her he will return, but because of his nonlinear nature, it could be in a year, or yesterday.
The crew splits up: O'Brien will teach at Starfleet Academy, Odo will join the Founders, and Worf will join Martok by becoming ambassador to Qo'noS. Montages highlight the relationships between O'Brien and Bashir, Ezri and Worf, Kira and Odo, Sisko and Jake, and Quark and everybody. Odo refuses to give Quark a fond farewell, but Quark is pleased anyway, thinking it an unspoken respect. Kira takes Odo to the Founder's planet, where he switches to a tuxedo before he sinks into the Link and cures the disease. Bashir and Ezri discuss their future relationship together. Nog discusses his promotion with new station commander Kira before she goes to Quark's to shut down his betting ring on the new Kai. Quark then tells Morn, "the more things change, the more they stay the same" (the last spoken line of the series). Finally Kira finds Jake on the promenade, and they both look out as the wormhole opens, knowing that their friend and father now resides in that Celestial Temple.