In 1715, the Catholic cantons, to regain prestige following their defeat during the Second Battle of Villmergen, renewed the Confederation's treaty with France with several major and unpopular changes. France was placed in the position of the guarantor of their freedom with rights of interfering in case of attack from forces within or without the Confederation. France also promised to procure restitution for the lands lost by the Catholic cantons to the Protestant cantons. This agreement removed much of the independence that the Confederation had enjoyed. In 1777, the unpopular clause was dropped from a renewed agreement between the Confederation and France and the independence of Switzerland was explicitly stated.