In the Frankish Empire, the area again stood on the border, this time between the Frankish Empire and the Principality of Hungary. To protect the Frankish Empire from Hungarian raids, a castle was built on Pyramid Hill. The castle was mentioned for the first time on 20 October 1164 as "Castrum Marchburch". A settlement soon began to grow below the castle. Maribor was first mentioned as a market near the castle in 1204, and it received town privileges in 1254. It is likely that the castle stood before 1164 because Bernard of Trixien, the count of the region, already used the title "Bernhard von Marchpurg" 'Bernard of Maribor' in 1124.