Feudalism developed in Japan as powerful clans and nobles (daimyo) gained independence and rivaled the emperor for control in the 9th-12th centuries. This led to many wars until a shogun unified the country in 1192, taking real power from the emperor. In the Edo Period starting in 1603, Tokugawa Ieyasu became shogun and established a feudal system with the daimyo lords divided under his control through a system of rotating residence, hostages, and obligations. This strict system maintained peace for over 250 years under 15 generations of Tokugawa rule.