Robert Hewitt Wolfe's original idea for this episode revolved around O'Brien discovering that he was a deep-cover Cardassian operative who had replaced the 'real' O'Brien twenty years previously and had had O'Brien's real memories implanted into his own mind. This would have meant that the O'Brien seen throughout Star Trek: The Next Generation (1987) and this series was actually a Cardassian spy. Wolfe ran into trouble with this idea when he had to try to explain how a Cardassian and a human woman (Keiko) could have a fully human child (Molly). At this point, Wolfe modified the idea so that it revolved around Kira instead of O'Brien.
Nana Visitor, who suffers from claustrophobia, greatly disliked wearing the extensive Cardassian makeup for this episode, which required her to arrive for makeup at 1:30 AM each morning. After a particularly long, 20-hour day of shooting, she simply told the director Les Landau that she had to get out of the makeup and pick up the remaining shots the next day because she was feeling claustrophobic. Landau wanted to continue shooting a while longer. Visitor then began physically removing the claustrophobia-inducing makeup on the set.
Garak's reference to the Defiant's cabins feeling claustrophobic is an early indicator of this character's irrational fear of confined spaces.
In the first sequence where the Cardassians contact Sisko while he is using the holofilter, the only shot of the Kobheerian disguise is stock footage of the original Captain from Duet (1993), with Avery Brooks lip syncing the first sentence. Norman Large, the original actor in the makeup, was not credited in this episode.
Robert Hewitt Wolfe says he was influenced in writing this episode by the work of Philip K. Dick, especially Do Androids Dream of Electric Sheep? (the book upon which Blade Runner (1982) was based) and "We Can Remember It for You Wholesale" (the short story upon which Total Recall (1990) was based).