It took well over 50 years and the work of three of Japan’s most powerful warlords (including the legendary Demon King Oda Nobunaga) to turn Japan from a loose confederation of semi-independent states into a unified country. So, it’s understandable that once the Tokugawa clan emerged as the last one standing in the fight for a united Japan in the early 17th century, they were rather keen on keeping the country from splintering again. With that goal in mind, they created a unique group of government spies who eventually helped shape the modern image of the ninja.

Portrait of Tokugawa Yoshimune

The Origin of the Garden Guards

One strategy the Tokugawa shogunate used to stay in power was mandating feudal lords to alternate their residences between their provinces and Edo (modern-day Tokyo), forcing them to keep lavish homes in two places and not leaving them with lots of extra money to foment dissent. The shogunate also developed the Tokaido route connecting Kyoto and Edo, with plenty of checkpoints along the way to make sure no armies or weapons were heading toward Japan’s capital. Then came the eighth Tokugawa shogun: Yoshimune (1684-1751).

The seventh shogun, Tokugawa Ietsugu, died at age six without leaving an heir. Fortunately, the clan had a contingency plan for such an occasion in the form of three branches of the Tokugawa family from which spare shoguns could be sourced. Yoshimune was of the Kishu branch, based in what is today Wakayama Prefecture and parts of Mie.

Called to Edo to govern, Yoshimune knew he’d need help to survive the challenges of Japanese politics in unfamiliar territory. That’s why he brought with him 20 of his most trusted “gunpowder handlers” and stationed them in Edo Castle. They were given the duties of guards (“ban”) and because they were headquartered in the gardens (“niwa”), they became known as the oniwaban, a kind of feudal mix of the Secret Service and the National Security Agency (NSA).

“View of Edo” (Edo zu) pair of six-panel folding screens (17th century)

The Shogun’s Eyes and Ears

On the surface, the oniwaban’s job was protecting Edo Castle and everyone within it by patrolling the grounds around the palace where the shogun lived and thoroughly vetting and keeping an eye on every craftsman, artist, or martial arts instructor allowed near the castle’s inner sanctum. However, their primary, secret duty was gathering intelligence and carrying out undercover operations for the shogun. While that may sound exciting, in reality, the task mostly boiled down to passing on news and rumors from around the city and occasionally joining government inspection tours in disguise to check if the provincial lords were getting rebellious.

Every report they made was carefully written up and cross-checked with other intelligence accounts to guarantee accuracy. And when an oniwaban was off on a mission somewhere, their absence was carefully noted in the official castle records as missing work due to sickness. So, think of the oniwaban less as feudal version of James Bond and more like 17th-century undercover bureaucrats. And yet these same people are also the ones who had a profound, everlasting effect on how we picture ninjas today.

How the Oniwaban Got Ninja-fied

Before the oniwaban, ninjas were known as many things such as assassins, guerilla fighters and masters of disguise. But, with a few exceptions, they didn’t really have a reputation for spying until their stories got mixed up with those of the oniwaban. Part of it might be because the oniwaban held the status of “Iga-mono” (a synonym for “Iga ninjas”). 

Before completing the unification of Japan and forming the Tokugawa shogunate, Tokugawa Ieyasu found himself fleeing from his enemies through the Iga domain in the 1580s. He was helped along the way by actual Iga ninjas and later employed them and their descendants as his personal guards at Edo Castle. However, over the years, these “Iga-mono” stopped performing actual ninja activities and their name became another word for a type of guard at Edo Castle.

The oniwaban were given that same title for the simple reason that it gave them a plausible excuse to have private audiences with the shogun, during which they could pass on secret intel to him. This was despite the fact that they had absolutely no relation to Iga. Playwrights, painters and later even manga and anime artists latched onto their “ninja in name only” title and ran with it fast and loose until the line between actual ninjas and the oniwaban became blurry.

This was additionally fueled by the oniwaban being extremely secretive. They had very strict rules forbidding them from interacting with regular Japanese citizens and almost every oniwaban was a descendant of the gunpowder handlers originally brought to Edo by Yoshimune.

Outsiders were almost never recruited into the oniwaban ranks, which made them seem more mysterious and, well, ninja-like. No wonder then that around the mid-19th century, it was rumored that the wildly misunderstood oniwaban spies had infiltrated the United States, which raises an important question: why hasn’t this story of ninja-esque Japanese spies in Abraham Lincoln’s America been made into a movie yet? This idea is free, Hollywood.



More historical deep-dives: