Contemporary audiences are familiar with the figure of the ninja. They have encountered it in numerous books, comics, and films, where ninjas appear as shadowy figures with lethal martial arts abilities. But did ninjas actually exist historically, or are they fictional characters born out of myth?
Ninjas did exist historically, although they were not referred to as such at the time. They were covert agents in feudal Japan who were paid to perform a broad range of clandestine military services. Contemporary accounts refer to them as Shinobi.
The rest of this article will explain when and where ninjas lived and describe some of the services a typical ninja would have performed as part of his duties.
When Did Ninjas Exist?
Ninjas existed between the 7th and 17th centuries. They enjoyed their heyday in the turbulent era known as the Sengoku or Warring States period and went into decline after the unification of Japan.
It is hard to pinpoint precisely when ninjas arose, as there is a lot of mythology surrounding the rise and fall of the Shinobi. According to Japanese legends, the Shinobi are said to descend from a demon that was half man and half crow.
More concrete evidence of historical Shinobi is available between the 7th and 10th centuries. One of the earliest historical recordings is of a spy named Otomono Sahito hired by Prince Shotoku sometime between 574 and 622 A.D.
In the 10th and 11th centuries, the ninja augmented their skills by learning new and innovative battle tactics from an eclectic range of foreign sources they came into contact with. These included warriors fleeing China after the fall of the Tang dynasty and Chinese monks trained in Indian fighting styles they had learned from the Tibetans. 
In the 12th century, the varied practices of ninjutsu–the art of the ninja–were formally codified by a former samurai named Daisuke Togakure and a warrior-monk from China named Kain Doshi. Togakure’s descendants went on to build the first ninja training center.
The ninjas truly came into their own during the Sengoku or Warring States period (1467-1568 CE).  This was an era of constant warfare when different warlords fought to establish their supremacy over Japan. The political turbulence and frequent battles of the time created a great demand for fighters and spies, roles for which ninjas were a perfect fit.
After the unification of Japan in 1603, the ninja’s star began to fade. They continued to be employed for a few decades more and then passed on into legend. It was peace that finally made them redundant.
Where Did Ninjas Live?
The Ninjas lived in the Iga and Shiga provinces of medieval Japan. Their hunting grounds roughly correspond to the cities of Iga in Mie prefecture and Koka in Shiga prefecture of present-day Japan.
The two most famous clans of the ninja were the Iga and Koga clans. Their traditional heartlands consisted of rural farmland and quiet villages in the two provinces that gave them their names.
According to some sources, the ninjas of the Iga and Koga clans were descendants of a petty class of samurai. Other sources say that the lower ranks of ninjas consisted of villagers and farmers. Whatever the case, ninjas were not nobility and, in all likelihood, were of a lower class than samurai.
Even today, the most important centers where people can appreciate ninja culture in Japan lie in Iga and Koka cities. The most significant ninja attractions include:
Visitors to Japan can also explore the Togakure Ninpo Museum in Nagano, which houses the very first ninja school established by the Togakure clan. 
What Did Ninjas Do?
What ninjas did was perform covert operations for the different samurai lords battling each other for supremacy over Japan. Their main tasks included gathering information, ambushing enemy forces and encampments, sabotage and diversionary tactics in battle, and executing opponents outside of battle.
The Bushido, the samurai code of honor, forbade samurai warriors from using any tactics that would besmirch their honor.  So, samurais could not spy on their enemies, sow disinformation, or kill an opponent in his sleep.
Samurais were primarily limited to engagement in open battle. However, open battle often resulted in stalemates where neither lord could gain an advantage over the other through straightforward means. Inevitably, this made subterfuge appealing.
Since samurai were forbidden by their code from using deception, they turned to the ninja clans to do their dirty work for them. The ninjas were not constrained by any warrior codes. They operated in a more covert style than the samurai, which allowed them to do things samurai warriors could not.
Ninjas preferred to avoid open engagement with their enemies in battle. Instead, they used stealth and deception to mingle with their enemies and extract information for their lords that could not be obtained by more straightforward means.
It is their focus on clandestine operations that gives the ninjas their near-mythical reputation for stealth. However, fact often goes hand-in-hand with fiction in these representations. In fact, the familiar all-black costume of the ninja in popular narratives is a fictional adaptation from Japanese drama of the later Edo era.
To maintain a discreet profile, historical ninjas were more likely to adopt the disguise of their enemies than to wear a costume that made them stand out. Thus, ninjas were known to assume the guise of a wide range of familiar characters from Japanese life, ranging from monks and priests to actors and magicians.
Ninjas were also trained, from childhood, to ride, swim, and handle a wide variety of weapons. They were incredibly fit and could evade enemies by climbing walls and jumping from heights. Such acrobatic feats of the ninjas contributed to their myth.
Ninjas often used everyday tools and inconspicuous objects as weapons. For instance, the kama, a type of sickle used across the Japanese countryside, was a favorite ninja weapon. Other ninja weapons were quickly concealable or could be broken down to pass as everyday objects that would not attract attention.
Ninjas were also famous assassins. They were adept at killing using various weapons including poisons. Eventually, the ninja became so well known for their stealth that legends are still told about their near-magical abilities today.
Ninjas are actual historical figures from medieval Japan. They were mercenaries who performed a range of covert operations for their samurai lords, including assassination.