While Legion had seemingly been unconnected to many parts of the X-Men comics, that all changed in "Chapter 7." The identity of the Devil with the Yellow Eyes was revealed to be the Shadow King on Legion. The Shadow King, also known by the identity of Amahl Farouk, is a major villain in the X-Men universe and has a connection to David Haller and his family. So what happened to the Shadow King in the Marvel comics? To prepare for the Legion season finale on Wednesday, March 29, let's get acquainted with this bad guy. Spoilers for the X-Men comics follow.
In "Chapter 6" of Legion, it was revealed that the then-unnamed Shadow King is a parasite that latched onto David's mind when he was a child. Then "Chapter 7" gave many more details about this psychic monster that has no body of its own. The episode showed that the Shadow King has taken on many forms within David's mind — his dog King, the fictional character of the World's Angriest Boy, and his friend Lenny (Aubrey Plaza).
The Shadow King is a bodiless, telepathic being that feeds off of human hosts in both the comics and the TV show, but these details of David's life in Legion don't match the comics. However, the story that David drew on the chalkboard with the rational part of his mind — a David with a British accent that brought me back to Dan Stevens in Downton Abbey (swoon) — in "Chapter 7" does connect to the comics in some ways.
David and his rational mind came up with the narrative that David's biological father was a psychic mutant, who had battled with the Shadow King. His father was enemies with this mutant and they fought in the astral plane with their minds. His father defeated the monster and so the Shadow King, which needs a host, decided to embed himself into David's mind — not only for his mutant powers, but for revenge against his father — after David was given up for adoption as a baby.
Although David doesn't know it yet in Legion, his biological father is Professor X and Charles Xavier has a long history with the Shadow King and his main human form, Amahl Farouk, in the comics. In this way, David's chalkboard story roughly resembles what happens in the comics since, according to the Marvel Universe wiki:
"One of the oldest and more powerful mutants ever, Amahl Farouk has been a threat to mankind at least for decades. He was the first evil mutant met by Charles Xavier, convincing him of the need of the X-Men. He has since been tried to recover and take over the world, always confronted by the X-Men, but never utterly defeated."
When Charles traveled to Egypt as a young man in the X-Men comics, he met the crime lord of Cairo, Amahl Farouk. Farouk was the host for the Shadow King and he wanted Charles to use his mutant powers for evil. The virtuous Charles refused and the two had a psychic battle on the astral plane (so yes, the astral plane in Legion is another comic connection) where Charles ended up being victorious and realized how dangerous evil mutants could be. While the body of Farouk died, the ancient Shadow King continued to exist without Charles realizing it and has continued to haunt the X-Men ever since.
In regard to the Shadow King's relationship with the mutant Legion (beyond his hatred of his father Professor X), the Shadow King possesses David during the Muir Island Saga, a five-part comic event from 1991. He infiltrated David's brain and took over his body so he could physically fight humankind. Yet again, Professor X defeated this evil entity on the astral plane, but this time with the help of other mutants. While the Shadow King was defeated temporarily again, this battle left Legion's mind broken and his body in a paralyzed state until he recovered in the Legion Quest story arc.
Legion has gone off script when it comes to the comic story line, but the core of what the Shadow King is has remained intact. And just as the Shadow King can never truly be defeated in the comics, don't expect him to be gone for good when Legion Season 1 comes to an end on March 29.