The island has been inhabited since before 6500 BC. Gaelic cultural influence began in the 5th century AD, and the Manx language, a branch of the Gaelic languages, gradually emerged. In 627, Edwin of Northumbria conquered the Isle of Man along with most of Mercia. In the 9th century, the Norse began to settle there. Norse people from Scotland then established the Kingdom of the Isles. The King's title would then carry the suffix, "and the Isles". Magnus III, the King of Norway, was also known as "King of Mann and the Isles" as part of the Hebrides civilization between 1099 and 1103. A Norse-Gaelic culture arose and the island came under Norse control. In 1266, the island became part of Scotland, as formalised by the Treaty of Perth. After a period of alternating rule by the kings of Scotland and England, the island came under the feudal lordship of the English Crown in 1399. The lordship revested into the British Crown in 1765, but the island never became part of the Kingdom of Great Britain or its successor the United Kingdom, retaining its status as an internally self-governing Crown dependency.