Flashbacks reveal that shortly after the twins' birth, Kirinmaru and Zero moved to eliminate half-demons due to the prophecy. To protect Inuyasha and Kagome from an unwinnable clash, Sesshomaru sealed them away within the Black Pearl at his father's borderland grave.
Meanwhile, Zero placed a silver-scale life-link curse on Rin. To keep Rin alive and halt the curse, Jaken deployed the Dream Butterfly to put Rin into stasis, transferring Setsuna's dreams and sleep to her mother. The seven Rainbow Pearls were born when the Great Dog Demon perished; Zero wept bitter tears and wished upon the Shikon Jewel to discard her emotions, crystallizing her sorrow into the pearls.
In the climax, Setsuna uses Yukari no Tachikiri to cut the karmic thread binding Zero’s sorrow, allowing Zero to find peace and Rin to wake. Moroha frees Inuyasha and Kagome from the Black Pearl in an emotional family reunion. Alongside Sesshomaru and Inuyasha, the three princesses permanently destroy the Grim Comet, lay Kirinmaru and Rion's spirits to rest, and set out together into a peaceful future.