The Legacy Virus is a fictional plague appearing in American comic books featuring the X-Men published by Marvel Comics. It first appeared in an eponymous storyline in Marvel Comics titles, from 1993 to 2001, during which it swept through the mutant population of the Marvel Universe, killing hundreds, as well as mutating so that it affected non-mutant humans as well.
The Legacy Virus, contrary to the name, was a viroid and was released by Stryfe, a terrorist (and clone of Cable raised by Apocalypse) from approximately 2,000 years in the future. It originally existed in two forms, Legacy-1 and Legacy-2, but later mutated into a third form, Legacy-3; all were airborne agents.
Legacy-1 and Legacy-2 searched for a target organism's "X-factor," the sequence of mutant genes that gave a mutant their superpowers. If it did not find an activated X-factor in the target, the viroid would die off, leaving the person completely unaffected. If, however, it did detect the X-factor, it would begin inserting introns into the transcription codings of the victim's mutant RNA, the process commonly being triggered after the patient used their powers for the first time after contracting the disease. The result was a major compromise of the replication and transcription process so disruptive that it eventually rendered the body incapable of creating healthy cells, ultimately resulting in the death of the victim. Prior to death, the viroid causes its host's powers to flare out of control.
Legacy-1 attacked general transcription and replication of all cells, a messy and non-selective process that resulted in a condition akin to a fast-replicating cancer. This is the version that infected Illyana "Magik" Rasputin, sister of Piotr "Colossus" Rasputin.
Legacy-2 was much closer to Stryfe's original template and more in tune with his desire to stir a species war between non-mutant humans and mutants. Its attacks were selective, working only on the X-factor genes. The net result was that a victim would eventually lose control of his superhuman powers.