During the 5th century, the area came under the rule of the Frankish Merovingian kings, who were probably first established in what is northern France. During the 8th century, the kingdom of the Franks came to be ruled by the Carolingian Dynasty, whose centre of power was around the area which is now eastern Belgium. The frankish kingdom had been divided up in many ways, but the Treaty of Verdun in 843 divided the Carolingian Empire into three kingdoms, whose borders had a lasting impact on medieval political boundaries. Most of modern Belgium was in the Middle Kingdom, later known as Lotharingia, but the coastal county of Flanders, west of the Scheldt, became part of West Francia, the predecessor of France. In 870 in the Treaty of Meerssen, modern Belgium lands all became part of the western kingdom for a period, but in 880 in the Treaty of Ribemont, Lotharingia returned to the lasting control of the Holy Roman Emperor. The lordships and bishoprics along the "March" (frontier) between the two great kingdoms maintained important connections between each other. The county of Flanders expanded over the Scheldt into the empire, and during several periods was ruled by the same lords as the county of Hainaut.