Trial of residence

A juicio de residencia (literally, "judgment of residence") was a judicial procedure of Castilian law and the Laws of the Indies. It consisted of this: at the termination of a public functionary's term, his performance in office was subject to review, and those with grievances against him were entitled to a hearing. This was largely an automatic procedure, and did not imply prior suspicion of misconduct.
The official was not allowed to leave the place where he exercised his authority, nor to assume another office, until the conclusion of this judicial inquiry. Generally, the person charged with directing the inquiry, called the "juez de residencia" (residence judge), was that individual already named to succeed to the position. The penalties for conviction varied, but generally consisted of fines.
The "juicio de residencia" took on great importance in the administration of the Indies, perhaps because of the great distances involved and the difficulty of direct supervision by the Crown. It extended from the viceroys and the presidents of the "Audiencia" to the alcaldes and the "alguaciles" (judicial officials, sometimes translated as "sheriffs"). With the entrance into force of the Spanish Constitution of 1812, the procedure no longer applied.
Originally, every viceroy had to pass his "juicio de residencia" before his successor could take office. But in the eighteenth century viceregal "juicios" were conducted after the outgoing viceroy had returned to Spain. During the lengthy process (up to six months), the degree of the viceroy's compliance with his instructions was analyzed, his job performance was reviewed, and many testimonies were collected from different parties.
Another formula the Crown used to control its officials, including the viceroy in his capacity as president of the "Audiencia", was the "visitador" who collected "visitas". The "visitador" was an inspector named at the pleasure of the king to investigate a particular administration. Like the "juicio", this institution had the aim of discovering abuses committed by the authorities, and proposing necessary reforms.