The city protected itself by joining the Swiss Federation ( Eidgenossenschaft ) , uniting itself in 1426 with Berne and Fribourg . The city protected itself by union with the Swiss Federation , uniting itself in 1526 with Berne and Fribourg .