Although the Sendai area was inhabited as early as 20,000 years ago, the history of Sendai as a city begins from 1600, when the daimyō Date Masamune relocated to Sendai. Masamune was not happy with his previous stronghold, Iwadeyama, which was located in the northern portion of his territories and was difficult to access from Edo (modern-day Tokyo). Sendai was an ideal location, being in the centre of Masamune's newly defined territories, upon the major road from Edo, and near the sea. Tokugawa Ieyasu gave Masamune permission to build a new castle in Aobayama after the Battle of Sekigahara. The previous ruler of the Sendai area had used a castle located on Aobayama. At this time Sendai was written as (a thousand generations), because a temple with a used to be located in Aobayama. Masamune changed the kanji to , which later became (literally: hermit/wizard plus platform/plateau or more figuratively, hermit on a platform/high ground). The character came from a Chinese poem that praised a palace created by the Emperor Wen of Han China (reigned 180-157 BCE), comparing it to a mythical palace in the Kunlun Mountains. Tradition says that Masamune chose this kanji so that the castle would prosper as long as a mountain inhabited by an immortal hermit.