Swiss mercenaries were already in use at the Papal court during the 15th century; the Guards, as we know them today, were formed in 1506 and acted as the personal guard of the Pontiff, even though they were sometimes employed in battle (e.g. during the Sack of Rome of 1527, during which the Swiss took heavy losses but managed nevertheless to bring the Pope to safety). The Guard's thus been tasked with the protection of His person ever since.
However, in the 19th century a number of other Guards' Corps were created such as the Guardia Nobile and the Guardia Palatina; these two were originally born as units of the Papal Army, but were later tasked with protecting the the Pope's residences (like the Quirinal palace). Both Corps were composed mainly by Italians and were only disbanded in 1970... although they had long been purely ceremonial by then. There was also the Gendarmeria Pontificia, which was both the former Papal States' police force and then the Vatican's (until 1971, when it was replaced by the modern Gendarmeria Vaticana) - this one too was manned by Italians.