"Demons" is the twenty-third episode of the fourth season of the American science fiction television series The X-Files. It premiered on the Fox network in the United States on May 11, 1997 and in the United Kingdom on BBC One on February 25, 1998. It was written by R. W. Goodwin and directed by Kim Manners. The episode helps explore the series' overarching mythology. "Demons" received a Nielsen rating of 11.8, being watched by 19.1 million viewers in its initial broadcast. The episode received mostly positive reviews from television critics, with many complimenting the episode's look in Mulder's mind.
 The show centers on FBI special agents Fox Mulder (David Duchovny) and Dana Scully (Gillian Anderson) who work on cases linked to the paranormal, called X-Files. Mulder is a believer in the paranormal, while the skeptical Scully has been assigned to debunk his work. In this episode, Mulder wakes up in a hotel with blood all over him and no memory of what happened. Mulder and Scully soon discover that Mulder was involved in a double homicide and may have been the killer. It is soon revealed that Mulder had been seeing a doctor who had allowed him to view glimpses of his past memories. After evidence becomes paramount, Mulder is cleared of the murder charges.
 The episode was written by R. W. Goodwin, an executive producer and director for the show. This marked the second instance where a member of the production crew wrote an episode, after the third season entry "Wetwired", written by Mat Beck. The episode was influenced by An Anthropologist on Mars, a series of essays by Oliver Sacks, in particular The Landscape of Dreams featuring a man who could recall every detail of his childhood. During the flashback sequences in the episode, various effects were created by manipulating the camera and its film.
 Fox Mulder's (David Duchovny) mind flashes back to being in the attic with his sister Samantha while their parents are arguing downstairs. Back in the present, Mulder wakes up in a hotel room in Providence, Rhode Island, covered in blood. Mulder calls Dana Scully (Gillian Anderson), who arrives, finding him in shock. Mulder has a pounding headache and has no memory of what he has done in the past two days. Scully finds that two bullets have been fired from Mulder's gun and that he has keys belonging to a David and Amy Cassandra. Scully wants Mulder to check into a hospital, but he wants to find out if he was involved in a crime before doing so. The agents arrive at the Cassandras' house where the housekeeper tells them they are not at home. Mulder recognizes a house in many of the Cassandras' paintings: a house that is near his parents' summer home in Rhode Island. When they arrive there, Mulder has striking pains in his head and flashes back again to when he was a child, seeing a younger version of The Smoking Man (Chris Owens) in his home. The agents enter the home, where they find the Cassandras dead from gunshot wounds.
 The agents call the police, who take Mulder with them due to the circumstantial evidence against him. Scully performs an autopsy on Amy Cassandra, finding a scab on her forehead. The detective in charge of the case tells Mulder that they have found David and Amy's blood on his shirt. Mulder refuses to confess to the murders, not remembering anything. Scully arrives, saying she found in Amy's blood traces of ketamine, an anesthesic substance that has hallucinogenic properties. The substance was detected in Mulder's blood as well. Meanwhile, one of the officers at the station kills himself; he has similar symptoms to that of the Cassandras. Mulder suffers a seizure and flashes back to his childhood again, witnessing his parents arguing with The Smoking Man. Scully sees Mulder the next day, telling him that she believes that the Cassandras killed themselves after receiving psychiatric treatment and that Mulder was visiting them about their alien abduction experiences.
 The agents visit Dr. Goldstein in Warwick, Rhode Island, who was treating Amy with an aggressive method to help her recover her abduction memories. Goldstein also treated the police officer, but says he has not met Mulder before. Mulder has another painful flashback of The Smoking Man arguing with his mother, Teena Mulder. Mulder declines Scully's request that he go to the hospital and goes to visit his mother, demanding she explain what really happened when they had to make a choice between him and Samantha. Mulder believes that The Smoking Man forced them to take Samantha. Mulder also questions who his father really is. Mulder's mother gets upset and refuses to provide him answers. Later Mulder visits Goldstein, and convinces him to again treat him so he  will remember what really happened. Mulder has further visions of the past. Scully and the police arrive soon after to arrest Goldstein but find Mulder gone. Scully finds him at the family's summer home in Rhode Island and is able to calm him down. While Mulder is cleared in the deaths of the Cassandras, what truly happened when he was a child remains a mystery.
 "Demons" was written by R. W. Goodwin, an executive producer and director for the show. Goodwin was inspired to write the episode after reading "The Landscape of Dreams", an essay by the neurologist and best-selling author Oliver Sacks from the anthology book An Anthropologist on Mars: Seven Paradoxical Tales (1995), which details a man who could recall every detail of his childhood. Interested in this idea, Goodwin developed a story in which "Mulder wakes up in a strange place [with] no idea how he got there". After receiving approval from series creator Chris Carter, Goodwin spent approximately six weeks writing the final episode.
 The episode explores the past of The Smoking Man, the series' chief antagonist. William B. Davis, the actor who played the character, later noted, "As the story developed, we developed a relationship between Cigarette-Smoking Man and Mulder's apparent father, and Cigarette-Smoking Man and Mulder's mother; then we started backfilling with an historical connection." Carter explained that the episode was the start of the series' greater conspiracy: "It's an interesting development because it really was the development of the conspiracy. The elements of the conspiracy were part of his development. But [The Smoking Man's] back story, of course, intertwined with Mulder's." For this episode, actor Chris Owens reprised his role as The Smoking Man; he had previously played him in the season's earlier episode "Musings of a Cigarette Smoking Man".
 The episode is based around the idea that Geschwind syndrome (a group of behavioral phenomena, of which one is the ability to recall every memory of one's younger life) can be self-induced by using a unique combination of technology and drugs—something that is not supported by modern medicine. When writing the episode, Goodwin was aware of the idea's implausibility and admitted that he took significant creative liberties with the disorder. In fact, the technology used in the episode to induce Mulder's flashbacks was based on various New Age equipment, including a "brain stimulator".
 The cottage used in the episode was actually a farmhouse located in South Surrey, near where the previous episodes "Home" and "Tunguska" had been filmed. The show's art department rented and refurbished the house, took photographs of the building, then returned it to its original state for the actual filming. The paintings of the house were then manipulated with Adobe Photoshop and Corel Painter, allowing it to look like Amy Cassandra had made numerous paintings of the house.
 The show's camera operators and editors made use of several distortion techniques to give the flashback sequences a hazy, uneasy, and "dystemporal" feel. First, the camera's shutter was "continuously stopped and started" to give the captured scenes an "out-of-time" feel. The scenes' colors were then manipulated by having the film strips negatives filtered with strobe lights during processing and development. To add to the sense of disorientation and confusion, the scenes' dialogue was mixed in with ambient background noise by producer Paul Rabwin.
 "Demons" was originally broadcast in the United States on the Fox network on May 11, 1997, and was first broadcast in the United Kingdom on BBC One on February 25, 1998. This episode earned a Nielsen rating of 11.8, with an 18 share, meaning that roughly 11.8 percent of all television-equipped households, and 18 percent of households watching television, were tuned in to the episode. It was viewed by 19.10 million viewers.
 Critical response to the episode was mostly positive. Zack Handlen from The A.V. Club wrote highly of the episode and awarded it an A−. Handlen praised the episode's exploration of Mulder's mind, noting that the entry allowed the audience to see Mulder's views of the world. He argued that "Mulder's desperate need to understand what happened to his sister […] drives him to expect betrayal, because at least with betrayal, the world makes some kind of sense." He did write, however, that he was "a little disappointed at how "Demons" doesn't really hold up in retrospect from a story perspective," but noted that "what does work here is great." Paula Vitaris from Cinefantastique gave the episode a largely positive review and awarded it three-and-a-half stars out of four. She wrote that "Demons" works "as a character study of Mulder" and praised the episode's "hyper-realistic flashback" sequences. Vitaris, while calling the structure of the story "not particularly imaginative", wrote that "Mulder's condition is intriguing". Not all reviews were positive. Robert Shearman and Lars Pearson, in their book Wanting to Believe: A Critical Guide to The X-Files, Millennium & The Lone Gunmen, rated the episode one-and-a-half stars out of five, calling it "the wrong episode at the wrong time." The two argued that the attention given to Mulder's potential "aneurysm" are oddly juxtaposed next to Scully's real, life-threatening brain cancer. However, they did call the flashback sequences "masterpieces of editing", but noted that their contents "lack[ed] information".