"The Dark Crystal" (1982)
Excerpts from Wikipedia:
1) Jen, an elf-like Gelfling taken in by the Mystics after his clan was killed, is told by his Mystic master that he must find the crystal shard, and that it can be found in the home of Aughra. If he fails to do so before the three suns meet, the Skeksis will rule forever.
2) Jen meets Kira, another surviving Gelfling who can communicate with animals, and her pet Fizzgig. They discover that they have a telepathic connection...
3) Jen is discovered and drops the shard, but Kira throws it back to him and is stabbed to death by the Skeksis' high priest. ... Jen inserts the shard into the Crystal, unifying it as the Mystics enter the chamber and the dark palace begins to crumble away and transform into a castle of bright crystal. As Aughra, Jen and Fizzgig watch, the Mystics and Skeksis merge into tall glowing beings, known as UrSkeks, one of whom says, "We are again one", speaks to Jen of their history, and revives Kira.