The Swiss Confederation secured its independence from the Holy Roman Empire in 1499 .