Plot summary
Keiko O'Brien returns to Deep Space Nine from a trip to Bajor and tells her husband Miles that she is not actually Keiko but an entity possessing her body. She proves this to Miles by stopping her heart for a few seconds. Miles is given a list of modifications to make to the station, but isn't told what the entity's ultimate goal is. The entity makes it clear it is willing to kill Keiko as well as their daughter Molly if he tries to tell anyone. Miles infers that the entity is probably a Pah-wraith from Bajoran legends; but this doesn't help him devise a way to stop it. When he tries to alert others to what's going on, the Pah-wraith anticipates this and makes Keiko fall from a balcony. Keiko is just injured, but the entity manages to secure Miles's silence.
Being under a strict time limit, Miles enlists night-shift technician Rom to assist him with the modifications, instructing Rom to tell no one about what he is doing. Science officer Jadzia Dax spots the modifications, and, suspecting sabotage, alerts the Operations staff; Miles is forced to implicate Rom to divert suspicion from himself.
Rom is incarcerated but refuses to divulge anything about what he was doing and why. He insists that he will only speak to Miles. Rom has determined that the modifications they are making will fire a beam that will kill the Prophets. Rom and Miles are able to piece together what is going on: the Pah-wraiths are the Prophets' natural enemies, and the one possessing Keiko is using her to kill them all at once.
Security chief Odo is still suspicious, however, and confronts Miles while he is performing the last modifications. Miles knocks him unconscious, finishes the modifications, and calls "Keiko" to tell her to meet him at a runabout so he can take her to the wormhole. However, Miles actually fires the beam at the runabout, killing the Pah-wraith and leaving Keiko uninjured.
O'Brien rewards Rom for his hard work and help by promoting him to the day shift. Miles and Keiko later talk about the experience. Keiko believes the Pah-wraith would never have left either of them alive, and both are relieved their ordeal is over.
Credits
Adapted from Wikipedia contributors, The Assignment (Star Trek: Deep Space Nine). Paragraphs and formatting adjusted; illustrations, reference markers, block quotations and non-story material omitted.