The military history of Switzerland comprises centuries of armed actions, and the role of the Swiss military in conflicts and peacekeeping worldwide. Despite maintaining neutrality since its independence from the Holy Roman Empire in 1499, Switzerland has been involved in military operations dating back to the hiring of Swiss mercenaries by foreign nations, including the Papal States. Old Swiss Confederacy Formed with the Federal Charter of 1291, an alliance of three cantons was formed for mutual defense, chiefly against the Habsburgs. A succession of interventions by the Habsburgs led to the battles of Morgarten (1315) and Sempach (1386), resulting in independence for the confederacy. By 1353, the original three cantons had been joined by two additional cantons and three city-states. Swiss mercenaries Late in the thirteenth century, soldiers drawn from the cantons of Switzerland gained a military reputation throughout Europe. This reputation was earned as a result of their defense against the Austrian Habsburg overlords and during campaigns in Italy. By the fifteenth century the Swiss had become particularly valued as soldiers-for-hire. Swiss soldiers were noted for their combat skill and ferocious attacks in the phalanx, or deep column formation using pike and halberd. They had a virtual monopoly on pike mercenary service up until 1490. By 1490, German mercenaries had become proficient in Swiss military tactics and were available for hire at a lower cost. In 1515, the Swiss pledged themselves to neutrality, and they only continued to fight in the service of the Royal French army. They became bitter rivals with the German mercenaries and the two would often fight on the battlefields of Europe during the next few decades. Following the Battle of Marignano in 1515, the Swiss style of massed-combat fighting went into steady decline, to be replaced by the arquebusiers, artillery and earthworks. During the Battle of Bicocca in 1522, the Swiss mercenaries met a bitter defeat with heavy casualties. Nonetheless, Swiss soldiers continued to serve as mercenaries during the next two centuries, adopting the musket to replace the pike. Swiss Guard The Swiss Guard has its origins in 1506 when Pope Julius II hired them as "bodyguards"; however the group of soldiers was large enough to be considered an army. This is appropriate, seeing as the Papal States took up one-third of Italy at the time, requiring extensive protection. The pope enlisted them, seeing as he believed they were the best at the time.