Madara was sealed in a shrine until he was accidentally released by Natsume. Because Madara was trapped in a material form for so long, Madara ordinary takes on the shape of a maneki neko (lucky cat), leading Natsume to nickname him Nyanko-sensei. In this form, other people can see him, leading for Natsume having to ask his guardians if he could keep him as a pet.
Madara is a powerful spirit, who protects Natsume from others and teaches him spells on occasion, in return for Natsume's promise to give him the Book of Friends when he dies. They often fight each other, which leads to Natsume punching Madara on the face and knocking him out. Despite his protests of not being a cat, he likes to play with cat toys. Nyanko's design is based on a lucky cat statue Midorikawa was given as a child. In the anime, Natsume is more respectful to Madara.