A ninja or shinobi 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, with their underhanded tactics, were contrasted with the samurai, who were careful not to tarnish their reputable image.