Undercover in a variety of costumes, they infiltrated enemy territory to learn how to build drawings, slip secret passwords and spread misinformation. If necessary, they were also ready for sabotage, mainly in the form of arson. If you grew up watching Power Rangers, pretending to be James Bond and playing Mortal Kombat video games, you’ve probably developed a love for ninjas.

Such tactics were considered unpleasant even at first, when, according to the 10th century Shōmonki, the spy boy Koharumaru was killed for spying against the insurgent Taira no Masakado. Later, the 14th century war chronicle Taiheiki contained numerous references to the shinobi and attributed the destruction of a castle by fire to an unnamed but “highly qualified” shinobi. The functions of a ninja included espionage, deception and surprise attacks.

Although the ninjas did not fight for a religious cause, like the hashashim who fought against Christians in the crusades, the practice was in fact more spiritual than martial. As such, training to become a ninja involved learning a form of spiritual asceticism known as shugendo. People who trained would exercise their bodies long distances through difficult terrain or by sitting under waterfalls for a long time. Teenage mutant ninja turtles can come from New York underground, but real ninjas actually come from imperial China, and combat practices have been imported from places like Tibet and India. In the 7th century AD, Japan underwent rapid changes which consolidated the power and wealth of the Japanese elite in a feudal system, much like that of medieval Europe.

Other ninjas who survived the battle of Iga, which meant the beginning of the end of the Sengoku era, helped write art to preserve it. However, this means of self-government and self-defense was an anathema for the daimyo, for whom the distinction between rich and poor was an essential means of seeing and interacting with the world. Warlord Oda Nobunaga, who lived in the 16th century, set out to create a united Japan, a state under the shogunate. This movement led to the Iga revolt when Nobunaga attacked the Iga and Koga clans with a force of 40,000 men. He forced the ninja to wage an open war in the fields, for which they were not trained. The ninja power bases in Iga and Koga were destroyed and the fighters had to flee to the mountains.

The wealthy European lords had knights to protect their homes and possessions; the Japanese had samurai. After a period of revolt and political instability, the samurai have accumulated enough power to establish the shogunate or the military state. The tactics of subterfuge, ambush and deception, as well as their use of projectile weapons, meant that Ninja ninjas did not enjoy the high reputation that samurai warriors, perhaps not entirely fair, acquired to be chivalrous and brave. In the Edo period and in the peace that followed the Tokugawa domination of Japan, ninjas were no longer needed in such large numbers, so that the formal martial art of ninjutsu was developed to continue their traditions.