A shaken O'Brien returns to Deep Space Nine after his mind has been altered to make him believe that he spent the last two decades in prison. Accused of espionage by the Argrathi, he was given the painful memories of a 20-year incarceration — the alien race's time- and money-saving alternative to constructing jails — and released before his fellow officers could arrive to stop the punishment. Although the process took only a few hours, the effect on O'Brien is clearly devastating, and while he's told what he went through was not real, the memories are too vivid to be dismissed. While Bashir explores how to erase those memories, O'Brien must see a counselor to help him handle the intense psychological effects.
Bashir determines that, since O'Brien was subjected to a time-compressed interactive simulation of the prison experience, it feels like he really lived those 20 years. Only erasing O'Brien's mind can eliminate the memories. Since this isn't an option, O'Brien is forced to tough it out, and he tries to throw himself back into his work and life with his daughter and pregnant wife. But he can't escape the memories of his imaginary ordeal and of Ee'char, his cellmate and only friend.
As time goes by, O'Brien's nerves begin to fray. He imagines seeing Ee'char around the station, although he knows the alien wasn't real — and even hallucinates a conversation with him while sitting in Quark's. Worse, he begins snapping at others, including Bashir, Quark and Odo.
Having learned about his behavior, Sisko relieves O'Brien of duty and orders him to resume counseling sessions immediately. Angry, O'Brien confronts Bashir for informing Sisko. Just then, Ee'char appears to O'Brien and encourages him to let Bashir help, but O'Brien storms back to his quarters instead, where he snaps at his daughter Molly and almost hits her. Upset that he could have harmed his child, O'Brien goes to the Cargo Bay, takes out a phaser, and prepares to shoot himself.
Bashir arrives just as O'Brien is about to pull the trigger and engages him in conversation, causing O'Brien to finally reveal the source of his pain. While in prison, he killed Ee'char, whom he believed was hoarding food from him. O'Brien sees the experience as proof that his humanity is gone, making him a potential danger to family and friends. But Bashir reminds him that this memory is part of his cruel punishment at the hands of the Argrathi, and if he gives in to these feelings, they win. This provides O'Brien the strength to face his ordeal, and with the help of his counselor and some medication, he is soon on the road to recovery.