The city's history began in the 8th century as a Slavic Pomeranian stronghold, built at the site of today's castle. In the 12th century, when Szczecin had become one of Pomerania's main urban centres, it lost its independence to Piast Poland, Saxony, the Holy Roman Empire and Denmark. At the same time, the Griffin dynasty established themselves as local rulers, the population was converted to Christianity, and German settlers arrived from Western European states. The native Slavic population faced assimilation and discrimination in the following centuries. Between 1237 and 1243, the town was rebuilt, granted vast autonomy rights, and eventually joined the Hanseatic League.