A ninja (???) or shinobi (???) was a covert agent or mercenary in feudal Japan. The functions of the ninja included espionage, sabotage, infiltration, assassination and guerrilla warfare. Their covert methods of waging irregular warfare were deemed "dishonorable" and "beneath" the samurai-caste, who observed strict rules about honor and combat. The shinobi proper, a specially trained group of spies and mercenaries, appeared in the Sengoku or "warring states" period, in the 15th century, but antecedents may have existed in the 14th century, and possibly in the 12th century (Heian or early Kamakura era). In the unrest of the Sengoku period (15th–17th centuries), mercenaries and spies for hire became active in the Iga Province and the adjacent area around the village of K?ga, and it is from the area's clans that much of our knowledge of the ninja is drawn. Following the unification of Japan under the Tokugawa shogunate (17th century), the ninja faded into obscurity