This is an incredibly long read [heavily edited] taken from the following source:
www.entertheninja.comIt offers one of several interesting views of the origins of the ninja warrior and makes mention of the sohei warrior of china...
The ninjutsu-ryu (ninja warrior) originated in ancient times, in China, where it was a protective society dedicated to protecting its people's through the arts of war. You can find a wonderful book on their teachings in Sun Tzu's "Art of War." The chinese version of ninja was called Lin Kuei (forest demons), and also by other names. The secret society was first brought from China to Korea where the Hwarang warriors learned their arts, and finally to Japan around 715 CE from a mysterious figure emerged from the mountains named En no Gyoja, who was a Lin Kuei ninja, sought to develop the society in Japan, and that he certainly did, revealing it to the mountain families of the surrounding areas.
Then a few centuries later there developed the first three Japanese ninja-ryu. The Fuma-ryu (about722 CE), the Koga-ryu (about 939 CE), and then Iga-ryu (about 1030 CE). This all dates back from between 700 CE and 1050 CE, where they for the most part developed many smaller schools but operated as one school though in different regions, (except for the Fuma-ryu which operated separately) and eventually over a long period of time became separated.
En no Gyoja was a master of the secret society in Japan, and completely developed the Society in about 722 CE, thus the legend of the ninja was born. After the civil wars of the Chinese states (400 BCE-700 CE), many of the Society fled to Japan and settled in the Iga/Koga, and Hojo regions, where the Lin Kuei sought refuge in Japan, and overtime, especially from Gyoja, taught the mountain families, wandering warriors, monks, mercenaries, and peasants of Japan. Shinobi is the proper name for the ninja warrior of Japan, as they were not just trained in the art of war, but also in traditional chinese philosophy, including buddhism, taoism, confucianism, and the indigenous japanese religion of shinto, which they greatly followed. So spiritually, the shinobi called their philosophy shugendo, was a spiritual belief of Shinto and sorcery that the Tong had always followed, meaning "cultivating their deities' natural and harmonious powers, and also cultivating a pure heart" which was their most sacred goal as a ninja. They essentially believed that all paths were really the same, had the same nature."
As for more detailed Shinto beliefs, Belief in a great spirit similar to native american spirituality was revered as Kami, or the Life-Force"Ki", and was not necessarilly impersonal like the Tao, because in Shinto, everything has a personal spirit and is sacred. Then came the divine couple, perhaps the spirit taking form as God and Goddess, Izanagi and Izanami, who created all things.
The most important deity however came to be the first child of the divine couple, the sun goddess, Amaterasu, who rules the high plane of heaven, the abode of the shining ones. In the afterlife belief, there was no reincarnation or karma as there was in Buddhist beliefs. The soul was considered eternal and lived on in the land of the dead (underworld/astral plane) after physical death. The ghost of the dead could be benevolent or evil-like, and ancestral worship was greatly revered.
The ninja were very eclectic mystics, and accepted every belief system, so a ninja could practice their philosophy, while accepting others, and even becoming others and blending it into theirs. But what was most important was their personal philosophy, "Toh Shin Do," which meant, "way of the pure hearted sword"......Most ninja of the earlier times were Shinto, but later on Buddhism also became integrated into their beliefs....some were also taoists, confucianists, christians, pagans, witches, shamans, a mixture of many paths or a personal spiritual path could also be preffered, as every path is truelly the same, and can reach the same goal.
In about 939 CE, a famous warrior, Mochizuki Saburo Kanei, along with his son, trained under a ninja master named Tatsumaki Hossi (who was a member of the Black Dragon Tong society. A society similar to the Lin Kuei in China), and thus developed the Koga-ryu, Around the same time, the Fuma-ryu came out of the mists by a mysterious, and highly feared ravaging mercenary group who supported the Hojo region of Japan, but were active much earlier.
Now for the Iga-ryu origins. They were developed around 1030 CE by Lord Ikai, who was once a warlord in China who fled from there, and settled in Iga, and taught two people who would become the founders of Iga-ryu, Fujiwara Chikada, and Hogenbo Tesshin. There were also many buddhist and samurai schools that incorporated ninjutsu teachings, such as Tenshin Shoden Katori Shinto ryu in 1337 (a samurai-ryu), and the Negoro and Saiga ryu developing around that time period (Buddhist-ryu's), were very famous and thats why i am mentioning them now. They were called the Sohei, or warrior Buddhists, who saw most of their action fighting against the late Minamoto/Ashikaga emperors, up until the Tokugawa Shogunate.
There was the Kunoichi-ryu, developed by a female ninja, named Mochizuki Chiyome, who was from Koga, and developed it in the mid-16th century in the name of Takeda Shingen to whom she was most loyal. There was also the Yagyu ryu which was developed in the early 17th century by the Tokugawa ninja master, Yagyu Jubei, with support from Iga ninja master Hattori Hanzo who trained him, and i'll get into all this later as we progress. I will be taking my time and organizing the ninja history as accurately and simply as possible so their is no confusion. Most people when they begin to write about this, are in confusion as to the whole history and dont write things down accurately, and thats why everything is always never so clear. Just read Japanese history and their lies the truth to all the traditions..........
Ninja did NOT form from outcast samurai called Ronin. Allthough their were many Ronin who did become ninja, as did farmers and peasants, however, most ninja were mountainous people, the Yamabushi, or mountain warriors. That's not to say that samurai and rural farmers and peasants didnt perform covert acts themselves, because they certainly did, they just didnt have the intelligence and skill as the ninja did and usually failed in their attempts.
Samurai and Ninja were not at all very similar, their fighting arts and philosophies were developed much differently than one might think. Ninja developed their own form of the Bujutsu techniques, which included the following: Toh-jutsu "art of swordsmanship," Intonjutsu "art of stealth," Shurikenjutsu "art of throwing weapons, including stars, knives, darts, etc...," Bojutsu and Jojutsu, "the arts of staff and stick, primarily wooden weaponry arts including escrima, tonfa, the long and short staff, etc,"..... Kusari-jutsu "the arts of sickle, crescent, and and chain weaponry, including the kama, scyths, barbed and bladed chains, nunchaku, etc," Sojutsu "the art of the spear and other bladed staffs such as barbed poles and naginatas," Taijutsu "the ninja arts of unarmed combat, which were more like using hand claws and foot spikes instead of actual unarmed techniques, anything to kill the enemy in split second was learned, practiced, and taught; they were not in the environment that most other martial arts were in, and the same goes for the samurai arts." Mikkyo "the arts of secretive knowledge, including sorcery, poisons, shamanism, witchcraft, celestial invocations, etc....the arts of stealth are probably under this category, and not as a separate art as it was their most sacred art, and was kept in great secrecy......therein also lies their spiritual developments, astrology, etc....."
The ninja were not cold-hearted assassins, or spies, this is a misconception of samurai and folk beliefs who came to fear the ninja for their extraordinary power. They even went as far as to call them supernatural demons, and with this misconception, the ninja came to use that as a great advantage overtime, as they did develop the mysterious Genjutsu ghost techniques......the ninja were instead a highly warm-hearted group of people who merely tried to protect their mountainous homestead, as well as the country from its evil and bloodshed from samurai clans........there were evil ninja, certainly a vast number of them, so there were many, but it should be said that these were rebelious groups and were maybe 1/3 of the whole ninja population.........that 1/3 however changed drastically overtime as the wars intensified, and yes, there were even ninja wars, and yes, and vast number of them (now that would be exciting!), including the Iga and Koga separation beginning in the 17th century, maybe even late 16th, which would be the start of how it all happened......and the Fuma-ryu was always against the Iga-Koga ninja, as they were very bitter enemies as far back as 15th century, probably much earlier. Fuma ninja were considered the evil ones of the ninjutsu age for the most part, it depends on how we look at it.
This is the legend of the ninja, the most feared assassins the world had ever known.