While converting the station's old ore processing unit into a deuterium refinery, Chief O'Brien and Jake Sisko accidentally trip an old Cardassian security program, which was set to put the station on lockdown in the event of a Bajoran uprising during the occupation.
O'Brien, Jake, and Commander Sisko are trapped in the ore processing unit, an area of the station which was once run by Bajoran slave laborers. Failsafes in the system prevent the rest of the crew from accessing the area or beaming the trapped people out. When Jake crawls up the ore chute and tries to break out, the entire station locks down. An image of Gul Dukat plays on all the monitors, announcing that rioting Bajorans have escaped. Poisonous gas is released into the ore processing unit.
In Ops, Major Kira, Dr. Bashir, and Dax have been locked in to prevent presumed homicidal Bajoran workers from storming the station's control center. Odo is dismayed to find himself locked in his security office with Quark.
As the crew works to lift the lockdown program, another failsafe is tripped. The Dukat program on the monitors warns the crew that the whole habitat ring will soon be flooded with poisonous gas. The crew members in Ops are surprised to see Garak wander in. As a Cardassian, his access codes allow him to travel around the station during the lockdown, which was meant only to contain Bajoran workers, not their Cardassian overlords.
He advises the crew to shut off the life support system, which will prevent the release of the poison gas. Unfortunately, this will also leave them only twelve hours to resolve their situation before the oxygen runs out. He discovers he is wrong about that when the Dukat program announces that the station will self-destruct in two hours. When Garak tries to hack into the computer using Gul Dukat's identity, yet another failsafe locks him out and activates an array of weapons in Ops that shoot random blasts of phaser fire. The crew dives for cover.
Suddenly, they receive a visitor. It's the real Gul Dukat, who arrives in Ops after having received notification that the system had been tripped. He teases the hapless crew about their predicament, sauntering safely around Ops because the phaser fire is programmed to target non-Cardassians (even Garak is safe, although Dukat angrily points out that he would have made an exception if Garak had been on the station when Dukat designed this program). After deactivating the weapons in Ops, he attempts to use his leverage to get Major Kira to agree to having a Cardassian garrison placed on the station, but she refuses. While attempting to return to his ship, Dukat's delight is short-lived when a new program pops up onto the monitors. It is Legate Kell, Dukat's former commanding officer, who has left this recording in case Dukat tried to abandon the station during a worker revolt. Kell's voice angrily reminds Dukat that all of his access codes have been eliminated and that he must now "contemplate the depth of [his] disgrace...and try to die like a Cardassian." Now, no one - not even Dukat - will be allowed to leave the area before the self-destruct....
In the ore processing unit, O'Brien and the Siskos have managed to blast their way out by blowing up leftover ore. From Ops, Dax manages to shut down the force fields set up in all the station's halls. With ten minutes left, Sisko makes his way to the computer that controls the station's shielding, and fortifies the shields just enough to absorb the energy of the station's self-destruct system, saving the station.