was ruled by the Counts of Gruyères. Portions of the alpine passes were held, until the 19th century, by the Bishop of Sion. The expansionist policy of the city of Bern led them into the Bernese Oberland. Through conquest, purchase, mortgage or marriage politics Bern was able to acquire the majority of the Bernese Oberland from the indebted local barons between 1323 and 1400. Under Bernese control, the five valleys enjoyed extensive rights and far-reaching autonomy in the Bäuerten (farming cooperative municipalities) and Talverbänden (rural alpine communities). Throughout the Late Middle Ages, the Bernese Oberland, as a whole or in part, revolted several times against Bernese authority. The Evil League (Böser Bund) in 1445 fought against Bernese military service and taxes following the Old Zürich War, in 1528 the Bernese Oberland rose up in resistance to the Protestant Reformation and in 1641 Thun revolted. During the Middle Ages, the settlement pattern in the Bernese Oberland was somewhat consistent. A main settlement grew on the valley floor below an elevation near . This main settlement had a market and often a castle or other fortifications. This market town was surrounded by scattered villages, hamlets and individual farm houses to an elevation of . During the 14th–16th centuries, the Bernese Oberland villages began extensive trading with the Bernese grain producing towns in the lowlands. This allowed the alpine villages to renounce self-sufficiency in grain and focus on raising cattle in the high alpine pastures and bringing them down into the valleys in the winter (transhumance). They then exported cattle over the passes into Italy and into the Bernese lowlands. Around 1500, in addition to the seven medieval markets, eleven new cattle markets opened to allow the Bernese Oberland villagers to sell their cattle. After the Napoleonic invasion of Switzerland in 1798, the old Bernese order was fractured and the Bernese Oberland was separated from the canton of Bern, forming the canton of Oberland. Within this new canton, historic borders and traditional rights were not considered. As there had been no previous separatist feeling amongst the conservative population, there was little enthusiasm for the new order. The 1801 Malmaison Constitution proposed reuniting the canton of Oberland with Bern, but it was not until the Act of Mediation, two years later, with the abolition of the Helvetic Republic and the partial restoration of the ancien régime, that the two cantons were reunited. In 1729,