Odo made Starfleet aware of the possible Changeling infiltration on Q'onoS (the Klingon home world), and he, Sisko, O'Brien, and Worf devised a plan to reveal Chancellor Gowron's imposter. The foursome was able to sneak into Klingon space by having Doctor Bashir surgically alter their appearances so that they looked like Klingons (except for Worf of course), and using a Klingon Bird of Prey that Dukat had stole. The plan was to use special emitters which would cause any Changelings holding a solid form to revert to their liquid state. Everything seemed to be going perfectly; Gowron was in the Hall of Warriors with many other Klingons to see him revert into goo, but the emitters were destroyed when General Martok recognized the four of them. He threw them into a cell but admitted he also suspected Gowron may be a Changeling. The only way to make him revert to his gelatinous state at that point was to kill him, so Martok released the four, and Sisko went into hand to hand combat with Gowron. Martok suggested just shooting him with a phaser but Odo recognized that as dishonourable behaviour--something a Klingon would never do. He realized that Martok was the real Changeling and killed him, returning him to his gelatinous state. They realized that the Great Link had wanted Odo to think Gowron was the Changeling so that he would be killed, and Martok (the real Changeling infiltrator) could take over the Klingon Empire as Chancellor, leading them into war with the Federation. Gowron called a cease fire, and the possibility of a Klingon-Federation War ended.
Bajor had finally been accepted into the Federation, and as Emissary, Captain Sisko was receiving his first vision from the Prophets. In the vision, he was able to see the past and future of Bajor, which led him to find the lost city of B'hala. Any skepticism from Bajorans that he wasn't the real Emissary was gone by then. To strengthen the visions he was receiving, he asked Kai Winn to help him consult the Orb of Prophecy, with which he received a vision that if Bajor was to join the Federation at that point, it would be destroyed. The Bajoran people listened to him, and Bajor didn't join the Federation.
Quark bought an infant Changeling in a Ferengi business transaction; the Changeling was one of the hundred sent out by the Founders. Odo tried to make contact with it by teaching him how to shape-shift. After a while, it responded by making itself into a face, and creating eyes for itself with which to see Odo. Doctor Bashir examined it later, and found that it was going to die for some reason he couldn't determine. Odo held the Changeling in his hands, begging it not to die, when it suddenly absorbed itself into him. Odo's shape-shifting abilities had been restored.
Half way through season five was when hugely important events started occurring, which would rue almost every episode until the series' end. Things started when Garak received a message from the Gamma Quadrant, and found it was from Enabran Tain--the man who had gotten him involved in the Cardassian-Romulan attack on the Founder home world in season three. He and Worf went deep into Dominion Space to try and save him, but were captured by Jem'Hadar soldiers that took them to the same prison camp that Tain and Doctor Bashir were being held at. Doctor Bashir, however, was also safe on Deep Space Nine--apparently he had been replaced by a Changeling infiltrator. They also met the real General Martok, who we learned had been replaced by a Changeling at the beginning of this season. Back in the Alpha Quadrant, the crew of Deep Space Nine had discovered that there was an armada of Dominion ships preparing to come through the wormhole and attack. Chief O'Brien was preparing a particle beam to be emitted from DS9's sensor array that would seal the wormhole and stop the fighting before it started. If Garak, Worf, Bashir, and Martok didn't escape in thirty six hours, they would be trapped in the Gamma Quadrant. The beam failed, however, because the Changeling posing as Doctor Bashir on Deep Space Nine had sabotaged the efforts, and the Dominion fleet poured through the wormhole. Instead of attacking the station as had been suspected, the ships turned for Cardassia Prime. Dukat transmitted a message on all channels letting the Alpha Quadrant know that he had convinced Cardassia--broken from their war with the Klingons--to join the Dominion, and he had become Cardassia's new leader. In the Dominion prison camp, Garak was working on modifying a circuit network the prisoners had found behind a hidden wall panel in their cell. Modifying them would allow him to contact the runabout which had brought himself and Worf to the Gamma Quadrant (it had been left outside the prison camp by the Jem'Hadar) and instruct it to beam them out of there. After many hours he was successful and the four were all able to escape, but it was too late for Tain, who died of poor treatment. Back on DS9, the Bashir Changeling had stolen a runabout and was flying it into the Bajoran sun. He had aboard a trilithium explosive, which would destroy the entire Bajoran sector, including Deep Space Nine, if it exploded inside the sun's corona. From the runabout in the Gamma Quadrant, the real Bashir transmitted a message to DS9 about the Changeling, and Kira was able to stop the Bashir Changeling's runabout with a tractor beam.
Fleet after fleet of Dominion ships was pouring through the wormhole bound for Cardassia, where a colossal armada was building up. Starfleet ordered Sisko to do something--anything short of actually collapsing the wormhole this time--to stop the Dominion ships form coming into the Alpha Quadrant. O'Brien, Jadzia, and Rom came up with the idea of mining the wormhole with self-replicating mines (every time a mine was destroyed, its neighbour would replicate a replacement). The mouth of the wormhole was huge, so deploying enough mines to cover the entire exit would take a long time, and the Dominion forces at Cardassia Prime became aware of what was going on. O'Brien, Dax, and Rom took the Defiant to set up the mine field, and a Vorta (a species from the Dominion comprised completely of clones, that took orders from the Founders, and controlled the Jem'Hadar soldiers with a drug called Ketracel White, to which they were genetically adicted) named Weyoun told Sisko that if he didn't stop deployment of the mines, the Dominion would take over the station. Sisko ignored him, but sent out runabouts to protect the station, and with the Klingons as the Federation's new allies against the Dominion, General Martok's ship protected the Defiant as it deployed the mines. The mine field was completed, and the Dominion followed through with their threat. The great armada that had built up at Cardassia was far too much for the station to handle, and the Federation was forced to leave, while the Bajorans and civilians opted to stay behind with the Dominion. Gul Dukat was in command of Deep Space Nine, renamed Terok Nor once again, and the hostilities rising between the Dominion and the Federation had finally led to war.