Nightmare Moon

"Remember this day, little ponies, for it was your last. From this moment forth, the night... will last... forever!"

- Nightmare Moon

"You little foal! Thinking you could defeat me!? Now you will never see your princess or your sun."

- Nightmare Moon's mocking words to Twilight Nightmare Moon is one of the villains in My Little Pony: Friendship is Magic, and the main antagonist of the two-part pilot episode "Friendship is Magic" also known as "Mare in the Moon". Before that, she was known as Princess Luna, and is the younger sister of Princess Celestia.

It is unclear if "Nightmare Moon" is an Entity which possessed Luna or not; the show seems to lean that Nightmare Moon is Luna's alternate personality but the comics state that Luna was corrupted during her time on the moon.

History
Long ago, Luna and Celestia were both the rulers of Equestria, a land inhabited by ponies. Every morning, Celestia would raise the sun, and every evening, Luna would raise the moon. Together, they kept the balance perfectly. One day, however, Luna grew jealous: the ponies would be awake to enjoy the day and love, admire, and appreciate Celestia's work, but would always sleep through her far more beautiful night. One day, Luna turned on Celestia, saying she should be the only princess in Equestria, and raised the moon before the bitterness in her heart manifested and transformed her into Nightmare Moon.

Celestia did not want to fight Nightmare Moon and told her to lower the moon, but Nightmare Moon said her only royal duty was to destroy Celestia, and shot at her with magic beams, eventually knocking her down. Seeing no other way, Celestia reluctantly used the Elements of Harmony to overpower Nightmare Moon and banish her to the moon, creating the phenomenon known as "the Mare in the Moon" (a unicorn's face imprinted upon the surface of the moon). It is said that in a thousand years, on the longest day of that year, Nightmare Moon will make her return.

Nightmare Moon's return and redemption
Upon reading an ancient legend, Twilight Sparkle realized Nightmare Moon is about to return, however her mentor, Princess Celestia, encouraged her to make friends instead of worrying about the supposed "old pony's tale". Unfortunately, Twilight turned out to be right and Nightmare Moon was released during the Summer Sun Celebration, replacing Celestia who was supposed to attend it. Twilight and her soon-to-be friends chased Nightmare Moon into the forbidden Everfree Forest.

After conquering many obstacles left by Nightmare Moon in their path, they finally found the twisted mare herself along with the ancient Elements of Harmony, now reduced to inert stones. As Nightmare Moon whisked the Elements away, Twilight followed her into the portal and confronted her alone. She tried to use the Elements of Harmony like Celestia did, but for that she had to find the "spark" that would make a sixth Element appear. However, no matter how hard she tried, she couldn't make the spark, and Nightmare Moon destroyed the Elements.

Fortunately, when Twilight heard her new pony friends calling for her, she felt a different spark in her heart; making her realize that the real Elements are not just some stones: they exist in the hearts of her friends. That spark triggered the final element: Magic (also known, of course, as Friendship), and reanimated the shattered Elements, converting them into jewels for the six friends to bear. Using the Elements of Harmony, Twilight activated a spell that struck Nightmare Moon, exorcising the darkness from her and transforming her back into Princess Luna.

Celestia arrived in the ruins where the battle took place, admitting that she knew of Nightmare Moon's return, but knew the only way to defeat her was for Twilight to understand the importance of friendship. Celestia walked over to a cowering Luna, who apologized in tears for her actions, and was granted forgiveness. Later at the celebration (held by Pinkie Pie), even the other ponies forgave Luna, gifting her with a flower necklace.

Nightmare Night
In the season 2 episode Luna Eclipsed, Princess Luna, now uncorrupted (And with a new look. Lauren Faust, the show's creator, stated that this was because when Nightmare Moon was defeated, Luna was reborn with very low magic levels, and she transformed after getting her good powers back), returns to Ponyville during the holiday Nightmare Night, a holiday dedicated to Nightmare Moon depicting her as a scary bogeyman. Luna, with Twilight's help, tries to change her image from that of the terrifying Nightmare Moon, to a favorable one as Princess. Unfortunately, the nature of the holiday, combined with Luna's outdated mannerisms and flair for the dramatic, make her subjects more scared of her than ever. Her first attempts end disastrously, prompting her to decree Nightmare Night canceled, but Twilight persuades her to give Ponyville another chance. When Luna discovers that the residents actually enjoy being scared as part of the night's festivities, she uses the Nightmare Moon persona to help them have fun and thus gains their trust and friendship, particular that of a colt named Pipsqueak.

Season 4
During the Season 4 premiere two-parter, Princess Twilight Sparkle, Twilight attempts to figure out the source of the chaos seizing Equestria by drinking a potion which gives her flashbacks of the past. One of the flashbacks she experiences is of Luna becoming Nightmare Moon and assaulting Princess Celestia. At first Celestia is reluctant to fight her sister, but Nightmare Moon assaults her with dark beams and eventually wounds her, sending her plummeting to the ground. However, Celestia promptly recovers and arms herself with the Elements of Harmony, the power of which she channels into a powerful beam that overwhelms Nightmare Moon's defenses and seals her inside the moon.

Season 5
In the third of many alternate timelines created by Starlight Glimmer in the season finale "The Cutie Re-Mark", Nightmare Moon is in power, having imprisoned Celestia in the moon for years and with Rarity and Rainbow Dash working for her. When Twilight mentions time travel, Nightmare Moon tries to force her to lead her back in time to stop the Elements of Harmony from being found, threatening Spike. She shatters the Timberwolves that attacked Twilight and Spike, but with teleportation, Twilight gets Spike away from Nightmare Moon and travels back in time again in another attempt to restore the timeline.

Other appearances
Luna has a few cameos in the season 2 finale A Canterlot Wedding, flying in to guard Canterlot at nighttime, ironically not participating in the fight against the changelings for reasons unknown. After Chrysalis was defeated, Luna appeared next to Celestia and the Mane 6, asking if she missed anything.

She also appears in the season premier The Crystal Empire.

At the beginning of Seasons 2 and 3, it's revealed that Luna, alongside Celestia, turned Discord to stone with the Elements of Harmony and imprisoned King Sombra in ice while turning him to shadow, about a thousand years ago sometime before her transformation into Nightmare Moon.

Nightmare Moon in comics
In Issue 6 (Part 2 of the second arc), the nightmare forces turn Rarity into a new Nightmare Moon called Nightmare Rarity, possessed by their darkness. It is also said that the nightmare forces told Nightmare Moon/Luna what to do to make ponies fear her, that she promised them a kingdom of their own, and Luna thought they would die with the evil of Nightmare Moon gone, but they instead returned to the moon for one more chance in the cycle of the new moon.

In Issue 7, Nightmare Rarity imprisons the ponies in her dungeon once the Nightmare Forces defeat them, and resists Spike's attempts to get through to her. She tries to trick him with an illusion, but he realizes her deception. She has Shadowfright and his sidekick capture him and says the nightmare has only begun.

In Issue 8, the ponies escape the dungeon and decorrupt Shadowfright's sidekick, Jerome, with the power of friendship. Luna does the same to Shadowfright and his army, turning them back into the denizens of the moon. The ponies then use this power of friendship on Nightmare Rarity to weaken her, and with this, them thinking of memories of Rarity, and Spike's love for her along with his restored Fire Ruby, the Nightmare Energy and spirit of Nightmare Moon are destroyed, releasing Rarity from their control.

Nightmare Rarity speaks as if she were the original Nightmare Moon, and speaks of Rarity as a separate character, hinting that Nightmare Moon is the manifestation of Luna's bitterness magnified by or merging with the Nightmare Forces, returned through the cycle of the new moon to possess Rarity.

Luna appears in the comics as well, though not as Nightmare Moon, and with her mane and tail the way they were after she was restored.

In issue 32, moon rocks from the battle between Celestia and Nightmare fall down to the planet and cause some apples to come to life.

FIENDship is magic issue 4 explains what Nightmare Moon did on the moon. She came across some creatures who make ponies' dreams. She tried to invade Celestia's dream to haunt her but it was too strong. So she invade other ponies' dreams to spread rumors about Celestia. Celestia quickly put a stop to this. When Nightmare finally reaches her dream, Celestia banishes her permanently. Nightmare then turns the creatures into the nightmare forces.

Note: It is up for the fans to decide whether the comics are canon.

Theories
There are several theories about Nightmare Moon and Luna which say they're not the same entity. This was confirmed by Lauren Faust herself (though she also gave a speech in an interview about Nightmare Moon's "reformation"). Nightmare Moon could be in fact an enbodiment of dark magic possessing Luna and keeping her prisoner under her evil influence till she was finally released by the Elements of Harmony. However, this theory has been debunked by the episode Do Princesses Dream of Magic Sheep?.

As King Sombra made the Crystal Empire disappear for a thousand years, it was speculated that he had something to do with Luna's transformation into Nightmare Moon. He could have magnified her existing jealousy and bitterness into a dark transformation, or, in accordance with the above theory, a manifestation that possessed her. This theory may have been proven wrong as it was revealed that Celestia and Luna defeated Sombra in the past and imprisoned him, though that does leave the possibility that Sombra only started a more gradual transformation from Luna into Nightmare Moon. This theory was expressed in the youtube video, Fall of the Crystal Empire.

It has also been speculated by G1 fans that Tirek exists in Friendship is Magic and was the one behind Nightmare Moon's transformation. However, when Lord Tirek finally appeared he displayed no such power.

It has been said that there was an outside force behind Luna's transformation into Nightmare Moon, who also might have had a hand in Discord's escape. In the comics it is implied that this force was the Nightmare Forces, directly possessing her while exploiting the bitterness in her heart to get her to accept them (although it also could be that the Nightmare Forces in the comics are the spirit of Nightmare Moon since she still seems to be Luna, or at least a part of her).

Some believe Nightmare Moon to be an apocalyptic villain since eternal night would cause the world to freeze. Lauren Faust has said that eternal night was Nightmare Moon's first step to a plan to "usher in an era of evil".

It has also been speculated that she is now a ghost and that she is the mysterious Shadow Pony haunting Celestia and Luna's old castle in the Season 4 episode Castle Mane-ia, although recent comments have made this figure more likely to be Tirek.

Trivia

 * Nightmare Moon's backstory and her goal of bringing eternal darkness, as well as sometimes taking the form of dark smoke, gives her an undeniable resemblance to Makuta Teridax from the Bionicle series. Her being imprisoned on the moon and escaping her prison after a thousand years echoes the stories of Queen Nehelenia and the Shadow Queen, respectively. The former also has prehensile hair like Nightmare Moon does. The notion in the above theory that Nightmare Moon is an embodiment of dark magic possessing Luna is also similar to Sthertoth possessing Rukifellth, as Luna seems to remember being Nightmare Moon.
 * Nightmare Moon could be the embodiment of Luna's jealousy. This would be similar to Emerald's transformation into a dragon in Sailor Moon R, except that Emerald is destroyed along with her dragon form.
 * Nightmare Moon has also been compared to Maleficent, as she says "Stand back you foals" to the guards, which echoes Maleficent's line "Stand back you fools".
 * She also shares the same similarities of Mr. Edward Hyde the alter-ego form of Dr. Henry Jekyll.
 * Nightmare Moon might have been inspired in part by Nightmare, the main villain of Kirby's Adventure, whom Kirby fights on the moon. She also may have been inspired by the G1 villain Tirek, as the two share many similarities. In fact, many fans of the G1 series believe Tirek to be the one who manipulated Luna into becoming Nightmare Moon. Luna's transformation to Nightmare Moon as shown in Princess Twilight Sparkle also looks similar to transformations caused by Tirek's Rainbow of Darkness.
 * Luna's appearence drastically changes between the first two episodes and Luna Eclipsed. She becomes taller with a more slender build, a darker coat, and a translucent mane and tail filled wih stars, greatly resembling her sister Celestia. This may be due to her regaining power that was drained from her after getting hit by the Elements.
 * When Princess Luna is restored, Nightmare Moon seems to shatter to pieces, as pieces of what is believed to be the evil of Nightmare Moon are shown laying around Luna after the Elements are used on her. King Sombra is also shattered to pieces, as well as G1 villain Lavan.
 * Because Celestia is considered a goddess, Nightmare Moon could be considered the Devils counterpart. Lucifer betrayed Yahweh out of pride and envy which is what Luna did.
 * Princess Celestia has a slightly similar reaction to Luna's return that Ignitus does when Cynder is released from Malefor's control in The Legend of Spyro: A New Beginning. Luna's Nightmare Moon transformation is similar to the dark transformation of Cynder, except while Nightmare Moon's transformation seemed to be a manifestation of her jealousy, Cynder's transformation was purely through Malefor's power.