While it officially remained part of the lands of the Prince-Bishopric of Basel, starting in the 13th century Biel began making alliances with neighboring nobles and cities. In 1279 it allied with Bern. This first alliance was followed in 1311 by an alliance with Fribourg, a 1334 alliance with Solothurn, 1342 with Murten and 1395 with La Neuveville. The alliance with Bern became an eternal alliance in 1352, as Bern itself joined the Old Swiss Confederacy. Contradictory obligations to the Bishop of Basel, Jean de Vienne, and to the Imperial City of Bern led to a war in 1367. During the war, Biel was burned and the Bishop's castle was destroyed. After the extinction of the Counts of Neuchâtel-Nidau in 1375 the Bishop's power around the lake began to wane. In 1388, Bern gained control of Nidau Castle and the town of Nidau. However, the Bishop retained nominal power and influence in Biel. The two competing powers struggled for power in Biel for over 400 years and prevented the town from becoming completely independent from either powerful neighbor.