The popular image of the ninja is a stealthy killer who can materialize out of nowhere like a ghost and loose a storm of blades or fists. Once he has devastated his foe, he moves on as mysteriously as he came.
A ninja was a covert agent or mercenary of feudal Japan specializing in unorthodox arts of war. The functions of the ninja included espionage, sabotage, infiltration, and assassination, as well as open combat in certain situations. The ninja, using covert methods of waging war, were contrasted with the samurai, who had strict rules about honor and combat.
The origin of the ninja is obscure and difficult to determine, but can be surmised to be around the 14th century. However, the antecedents to the ninja may have existed as early as the Heian and early Kamakura eras. Few written records exist to detail the activities of the ninja. There was no word for naming these warriors until around the 15th century, and it is unlikely that spies and mercenaries prior to this time were seen as a specialized group. In the unrest of the Sengoku period (15th - 17th centuries), mercenaries and spies for hire arose out of the Iga and Kōga regions of Japan, and it is from these clans that much of later knowledge regarding the ninja is inferred. Following the unification of Japan under the Tokugawa shogunate, the ninja descended again into obscurity. However, in the 17th and 18th centuries, manuals such as the Bansenshukai (1676) — often centered around Chinese military philosophy — appeared in significant numbers. These writings revealed an assortment of philosophies, religious beliefs, their application in warfare, as well as the espionage techniques that form the basis of the ninja's art. The word ninjutsu would later come to describe a wide variety of practices related to the ninja.
The mysterious nature of the ninja has long captured popular imagination in Japan, and later the rest of the world. Ninjas figure prominently in folklore and legend, and as a result it is often difficult to separate historical fact from myth.