Thunstetten is a municipality in the Oberaargau administrative district in the canton of Bern in Switzerland. Thunstetten is first mentioned in 1220 as Tunchsteten. Individual artifacts from the neolithic era have been found in the Thunstetterwald. Hallstatt era grave mounds are in Tannwäldli and Bützberg. The Thunstetten Commandery was established prior to 1210 for the Knights Hospitaller by an unknown benefactor. During the 13th and 14th centuries, the Commandery lands grew with donations and purchases from local nobles. At the height of their power, they owned land in Oberaargau, the Bernese Seeland and around Solothurn. They bought vineyards in Twann and rights over village churches in Lotzwil, Ursenbach, Egerkingen, Aetigen, Rohrbach and Waldkirchen (now part of Niederbipp). As the Commandery grew, Thunstetten also grew. It had its own seal starting in 1274 and in 1320 entered into a Burgrecht agreement with Wangen. It entered into Burgrecht agreements with Bern in 1329, 1466, 1494 and 1504. Following the Protestant Reformation in 1528, the Commandery was secularized and its lands became the property of Bern. The former Commandery lands passed to the Bernese bailiff in Aarwangen. In 1711-13 Hieronymus von Erlach built Thunstetten Castle. Then in 1713 and 1721 he combined the herrschaft of Thunstetten with the low court of Thunstetten, which did not include Bützberg. The castle remained with the Erlach family until 1746, after which it changed hands multiple times. A foundation was established in 1971 to maintain and manage the castle as a Swiss heritage site of national significance. The area of today's municipality consisted of various population centers in the 13th century, which became villages in the 14th. The farmers raised crops and sometimes vineyards on the lands around the small villages. The villages remained fairly small, in 1780 Bützberg was the largest with 31 houses, Welschland had 24 and Thunstetten had 21. During the 18th and 19th centuries, many of the large farms were subdivided into smaller ones while the commons became private property.