the Halberdier Corps of the Viceroy's Royal Infantry Guard (Compañía de Alabarderos de la Guardia Real de Infantería del Virrey). Antonio de Ulloa described the Viceroy's bodyguard in 1740: "For the safety of his person and the dignity of his office, he has two bodies of guards; one of horse, consisting of 160 private men, a captain and a lieutenant. Their uniform is blue, turned up with red, and laced with silver. This troop consists entirely of picked men, and all Spaniards... These do duty at the principal gate of the palace; and when the viceroy goes abroad he is attended by a piquet guard consisting of eight of these troopers. The 2d is that of the halberdiers, consisting of 50 men, all Spaniards, dressed in a blue uniform, and crimson velvet waistcoats laced with gold. These do duty in the rooms leading to the chambers of audience, and private apartments. They also attend the viceroy when he appears in public, or visits the offices and tribunals." The Royal Halberdiers were the Viceroy's Guard for three hundred years until the Latin American wars of independence of the late 18th and early 19th centuries. Republican period The Peruvian Army was charged with protection of the Government Palace from 1821. Various army units stationed at the Palace also performed public duties. This role was shared from 1852 with the Peruvian National Gendarmerie (Gendarmería Nacional del Perú). From 1873, they were joined by the Civil Guard (Guardia Civil). President Augusto Bernardino Leguía Salcedo, then in his second term of office, permanently assigned an infantry battalion to safeguard Palace security and assume public duties on the model of the French Republican Guard, on the insistence of Peruvian Army General Gerardo Álvarez. The First Gendarme Infantry Battalion, later renamed 1st Republican Guard of Peru Infantry Gendarme Battalion of the Peruvian National Gendarmerie, was appointed presidential guard battalion by Presidential Decree of 7 August 1919. Florentino Bustamante was its first commanding officer, serving until 1923. The Guard Battalion was mandated to ensure security in all national government buildings, in particular of "the Government Palace and the National Congress". The battalion grew to become a full regiment, and moved to new barracks at the Quinta de Presa palace in 1931. Also in 1931, the Republican Guard Regiment was renamed the 2nd Infantry Regiment of Security under the government of President David Samanez Ocampo, in a failed attempt