When It Rains…

"When it Rains..." is the 171st episode of the television series Star Trek: Deep Space Nine, the fifth of the final nine-episode arc of the series. This episode was directed by Michael Dorn (who also played the role of Worf in the show) and written by Rene Echevarria. It was first aired in broadcast syndication on May 3, 1999.

Set in the 24th century, the series follows the adventures of the crew of the Starfleet-managed space station Deep Space Nine near the planet Bajor, as the Bajorans recover from a decades-long occupation by the imperialistic Cardassians. The station is adjacent to a wormhole connecting Bajor to the distant Gamma Quadrant; the wormhole is home to powerful alien beings worshipped by the Bajorans as the godlike "Prophets". The later seasons of the series follow a war between the United Federation of Planets and the Dominion, an expansionist empire from the Gamma Quadrant, which has already absorbed Cardassia; the Dominion is ruled by the shapeshifting Changelings.

This is the fifth episode of the nine-episode concluding story arc of the series, which brings the Dominion War and other story elements to a close. In episodes preceding this one, Gul Dukat, the Cardassian who governed Bajor under the occupation, disguised himself as a Bajoran and won the favor of the ambitious Bajoran spiritual leader Kai Winn, seducing her to the path of the Prophets' evil counterparts, the Pah-wraiths; the Cardassian leader Damar has launched a rebellion against Dominion rule; and the Changeling Founders of the Dominion have developed a mysterious illness with no known cure. This episode advances those plot lines, as Dr. Julian Bashir discovers that DS9's security chief Odo, a rogue Changeling, has been infected with the Founders' disease; Starfleet sends DS9's Bajoran second-in-command, Kira Nerys, to assist the Cardassian resistance; and Winn turns Dukat away. Meanwhile, the Chancellor of the Klingon Empire, an ally of the Federation, assumes personal command of the Klingon war effort.

Plot
The Dominion has deployed a new weapon that can disable starships with one shot; only Klingon ships can be made resistant to it as yet, and so the entire defense of the Alpha Quadrant is in the Klingons' hands for the time being. Klingon Chancellor Gowron visits DS9 to honor General Martok, the commander of the Klingon fleet, by inducting him into the Order of Kahless; but after the ceremony he announces he is assuming command of the fleet himself. He outlines his plan for a new offensive into Dominion territory in order to seize glory for the Klingon Empire, ignoring Martok's objections that they are badly outnumbered by Dominion forces and are overextended already merely defending the border.

To aid Damar's revolt against the Dominion, Captain Benjamin Sisko sends Kira, a veteran of the Bajoran resistance against Cardassian occupation, to train the Cardassians in guerrilla warfare strategies and tactics; she is accompanied by Odo and by exiled Cardassian spy Elim Garak. Anticipating the Cardassians' objections to being advised by a Bajoran former terrorist, Sisko has Kira given a Starfleet commission to lend her more authority. When she arrives at Damar's camp, his men object to her presence—especially when she tells them they must be willing to attack fellow Cardassians if they collaborate with the Dominion—but Damar is willing to take her advice seriously.

Bashir, examining a tissue sample from Odo, discovers that Odo is infected with the same disease plaguing the Founders. Attempting to develop a treatment, Bashir requests a copy of Odo's full medical records from Starfleet. Starfleet bureaucrats stonewall his request, claiming that the records are classified and questioning Bashir's loyalty for trying to cure a disease that primarily threatens the Federation's enemies. When Starfleet eventually sends Bashir a file, he discovers it is a fake. Extrapolating the history of the infection in Odo's system, Bashir conjectures that Section 31, Starfleet's secretive black ops division, deliberately infected Odo with the virus so that he would transmit it to the Founders.

Kai Winn is studying the forbidden Text of the Kosst Amojan to learn how to release the Pah-wraiths from their confinement. Dukat sneaks a look at the book and the Pah-wraiths punish him by blinding him. Winn throws Dukat out to live as a blind beggar, telling him he can return when his sight is restored.

Reception
"When It Rains..." had 4.3 million viewers when it was broadcast on television in 1999.

The episode received mixed reviews from critics. As an intermediate episode in a multi-episode story arc, it received criticism for having a lot of plot setup, but not much resolution.

In 2018, the final story arc of Deep Space Nine, including "When it Rains...", was ranked by Comic Book Resources as the best multi-episode story in the Star Trek franchise. In 2016, The Washington Post called the Dominion war story arc, of which this episode is a part, possibly the "richest narrative" of the Star Trek universe.