Note: Wes Craven died Aug. 30 at the age of 76.

“Morality sucks,” groans Glen, enviously enduring the muffled cries of passion coming from the nearby master bedroom. It is probably not his own morality Glen is thinking of, but that of his girlfriend Nancy, with whom he is spending the night at the house of their mutual friend Tina — though not in the way that Tina and her boyfriend Rod are spending it in Tina’s mother’s room.

Despite his ambivalence, Glen (Johnny Depp in his debut role) is basically a good kid, which is almost enough to save him. His girlfriend Nancy (Heather Langenkamp) is, of course, the chaste “final girl” whose virtue, empathy, imagination, and courage will enable her not just to survive the murderous onslaught of the blade-wielding maniac stalking her and her friends, but to defeat him.

By 1984, the tropes of the slasher film (or “Dead Teenager Movie,” as Roger Ebert dubbed this subgenre of horror), pioneered in 1978 by John Carpenter’s “Halloween,” were well established. Rivers of blood had been spilled in gruesome, exploitative slasher films during those six years, though only two memorable villains made any lasting impression: Michael Myers of “Halloween” and Jason Voorhees of the “Friday the 13th” sequels. (Both are associated with iconic masks; if you broaden the genre to include “The Texas Chainsaw Massacre” (1974), there is also Leatherface.)

To these, Wes Craven’s groundbreaking “Nightmare on Elm Street” added disfigured Fred (or Freddy) Krueger, played by Robert Englund in grotesque burn-victim prosthetics and a menacing clawed leather glove.

Like young Jason Voorhees, whose death by drowning at summer camp while camp counselors on duty were having sex forms the dark back story for the “Friday the 13th” films, Fred Krueger represents the hidden sins of the community, underscoring the connection between horror and suppressed guilt.

Some might expect Craven — who rebelled against his strict Baptist upbringing (in which movies were forbidden, along with dancing and even singing) while studying English and psychology at Evangelical bastion Wheaton College, and later went on to work in the pornographic film industry while trying to break into Hollywood — to share Glen’s assessment that “morality sucks.”

But “Nightmare on Elm Street,” which, like Craven’s later, self-aware “Scream” (1996), subverts slasher tropes in various ways, deepens rather than subverts the genre’s moral leanings. The back story, involving a child killer who was burned to death by a vigilante mob after getting off on a legal technicality, is unremarkable, but Craven extends the guilt of Nancy’s parents’ generation to include divorce, alcoholism, and the general moral decay of middle-class America.

“Nightmare” also incorporates a bit of “Exorcist”-influenced religious iconography into what was generally a resolutely secular, naturalistic genre. Krueger isn’t a demon in the traditional Christian sense, but Tina’s crucifix — prominently displayed on the wall over her shoulder in her real-world introductory shot as she wakes up from the opening nightmare — seems to offer at least some resistance to him.

After the nightmare, Tina instinctively takes the crucifix off the wall and places it in the bed beside her, as if to bring its protective power closer. Later, as Nancy sleeps in Tina’s bed while Tina and Rod sleep in Tina’s mother’s room, the crucifix falls off the wall, which becomes an elastic membrane through which Krueger begins to emerge, as if trying to cross the boundary between the realms of dream and reality. When Nancy wakes up and replaces the crucifix, the wall becomes reassuringly firm and solid again.

The “Exorcist” influence is most apparent during Tina’s grisly death scene in her parents’ room, immediately after sex with Rod, where there is no crucifix to protect her. First levitating off the bed, Tina winds up writhing on the ceiling in imagery evoking both the deleted “spider walk” scene from “The Exorcist” and the ghostly rape imagery from “Poltergeist.”

Like the demon in “The Exorcist,” Freddy blasphemes God, holding up his clawed glove in response to a whispered “Please God” from Tina and growling, “This is God.” Later, preparing to confront Freddy in his own realm, Nancy calmly murmurs the child’s bedtime prayer “Now I lay me down to sleep,” using the frankly somber ending: “If I should die before I wake, I pray the Lord my soul to take.”

Another bit of childhood doggerel (this one fictitious) commemorates the protective power of the crucifix over Freddy: a sing-song jump-rope counting chant bookending the film. “One, two, Freddy’s coming for you … five, six, grab your crucifix.” On the other hand, late in the film when Nancy pursues Krueger into the dream world, she discovers (rather inexplicably) Tina’s crucifix along with her boyfriend Glen’s headphones — trophies of past victims. The crucifix’s power over Krueger, then, is limited, not absolute.

That’s because Krueger comes not from hell, but from the subconscious, from the seemingly lawless world of dreams. The horror of “A Nightmare on Elm Street” is that the boundary between dreams and reality increasingly breaks down; not only do injuries inflicted in the dream world appear on the dreamers’ bodies, Nancy discovers that it is possible to bring objects physically out of the dream world, like Krueger’s hat, just as we later see that Krueger can bring trophies from the real world back to the dreamscape.

The surreal scares of “Nightmare” go beyond most slasher fare by evoking an irrational world in which normal rational defenses don’t apply. “Halloween” and the original “Friday the 13th” are theoretically set in the real world; the villain is a human being who can be injured or knocked down, and can be in only one place at a time.

Not only is Krueger unbound by such limitations, he stalks you in a world in which the treads of a staircase might become gooey and yielding under your feet, making them all but impossible to climb. The most famous scene in “Psycho” turns on our vulnerability in the shower, but in “Nightmare,” the killer could be lurking beneath the bubbles of your bubble bath, waiting to drag you down to impossible depths.

Adding to the terror, no place is safe; in a “cabin in the woods” story, you’re vulnerable only once you leave civilization behind, but here, just nod off in English class in broad daylight and you could be done for.

To battle Krueger, then, Nancy must engage him in the real world, where his powers seem greatly diminished. He still can’t be killed, but at least he’s tangible and has to walk through a door like anyone else. Unlike a monster in a dream, he doesn’t know what Nancy is thinking, and her tricks at least slow him down.

Perhaps reflecting Craven’s confidence in his material, “Nightmare” is more restrained and less exploitative than typical slasher films. There is no explicit nudity or onscreen sex; the body count is relatively low (just four), and, while two of the actual killings are over-the-top bloodbaths and there’s some gross-out imagery, the deadly violence is stylized rather than graphically portrayed. We never actually see Krueger’s blades slice into his victims’ flesh; the worst killing depicts the victim’s body being slashed and battered by an invisible assailant, while another victim is swallowed by his bed which explodes in a geyser of blood.

Despite the relative restraint, the genre’s typical sadism is in evidence. Significantly, all the dreamscape stalking and menacing involves the female characters, while the male characters simply die in their sleep. Although Craven almost never invites us to identify with Krueger by filming from his point of view, an iconic shot depicts Nancy dozing in the tub with her face framed between her wide-apart knees as Krueger’s claw rises between her legs.

In the end, “Nightmare” ultimately proposes a rather high-minded solution: A monster like Krueger is a creature of violence and fear, so the way to beat him is not through more violence, but by depriving him of the source of his power.

But then, at the behest of Craven’s producer, comes one last shock reversal — a nihilistic “gotcha” that might leave viewers laughing nervously as the credits roll, but that undermines not just the whole third act, but also the carefully worked-out rules that make the film persuasive. In its final moments, a relatively well-crafted horror film made with some real conviction is reduced to just another “boo” movie with a filmmaker’s shadow looming conspicuously behind the monster.