 As Madoka contemplates accepting the contract with Kyubey , she witnesses the death of Mami at the hands of a witch and realizes that a magical girl 's life is filled with danger , anguish , and suffering . This is further enforced by the appearance of Kyoko Sakura , a veteran magical girl whose wish indirectly caused the death of her family . Madoka also discovers that not only do magical girls give up their souls to form their Soul Gems , the source of their magic , but when those Soul Gems become too tainted with despair , they transform into the very witches they fight against . This is exemplified when Sayaka , heavily disillusioned with the current state of the world , falls into an irrecoverable despair that turns her into a witch . It is then revealed that Kyubey 's alien race is harvesting the emotions from magical girls to use as energy to counteract the spread of entropy . Madoka also learns that Homura is a magical girl from a different timeline who has repeated the same month countless times in order to try to save her from a grisly fate . After these revelations , Madoka decides to become a magical girl with the wish to stop witches before they are created . This rewrites the laws of the universe , resulting in Madoka becoming nothing more than a concept and Homura being the only one who remembers her in the new world that is formed . 
