In the history of Japan, ninja (also known as shinobi) operated as spies, assassins, or thieves; they formed their own caste outside the usual feudal social categories such as lords, samurai, and serfs. Ninja often appear as stock characters in Japanese and global popular culture.