Real Audiencia of Quito

The of Quito (sometimes referred to as "la Presidencia de Quito" or "el Reino de Quito") was an administrative unit in the Spanish Empire which had political, military, and religious jurisdiction over territories that today include Ecuador, parts of northern Peru, parts of southern Colombia and parts of northern Brazil. It was created by Royal Decree on 29 August 1563 by Philip II of Spain in the city of Guadalajara (Volume I, Book II, Title XV, Law 10 of the "Recopilación de Leyes de Indias"). It ended in 1822 with the incorporation of the area into the Republic of Gran Colombia.
Structure.
The 1563 decree established its structure and district:
In the City of San Francisco of El Quito, in Peru, shall reside another Royal "Audiencia" and Chancellery of ours, with a president; four judges of civil cases ["oidores"], who will also be judges of criminal cases ["alcaldes del crimen"]; a crown attorney ["fiscal"]; a bailiff ["alguacil mayor"]; a lieutenant of the Gran Chancellor; and the other necessary ministers and officials; and which shall have for district the Province of Quito, and along the coast towards the Ciudad de los Reyes [Lima] to the Port of Paita, exclusive; and inland towards Piura, Cajamarca, Chachapoyas, Moyobamba and Motilones, exclusive, including towards the aforesaid part the towns of Jaén, Valladolid, Loja, Zamora, Cuenca, La Zarza and Guayaquil, with the rest of the towns, which are in their districts or will be founded [in them]; and towards the towns of La Canela and Quijos, it should include said towns and the rest that shall be discovered; and along the coast towards Panama, until the Port of Buenaventura, inclusive; and inland to Pasto, Popayán, Cali, Buga, Chapanchinca and Guarchicona; because the rest of the places of the Government ("Gobernación") of Popayan are of the "Audiencia" of the New Kingdom of Granada, with which, and with the one of Tierrafirme [Panama], it shall share a border on the north; and with the one of Los Reyes in the south; having for its western border the South Sea [Pacific Ocean] and eastern the provinces still not yet pacified nor discovered.
The "Audiencia" was effectively autonomous because the Viceroyal government (to which the "Audiencia" was technically subordinate in political matters) was too far away to administer its territories effectively. Thus, power was devolved to the "Audiencia" by the Viceroy and the "audiencia" territory was directly administered by the President of the "Audiencia" and the political, military, and religious officials underneath him. Initially the "Audiencia" of Quito formed part of the Viceroyalty of Peru (1563–1717) and (1723–1739). Later the "Audiencia" was part of a newly created Viceroyalty of Nueva Granada (1717–1723). This Viceroyalty was temporarily suppressed by the King of Spain in 1723 and the "Audiencia" of Quito returned to the Viceroyalty of Peru. In 1739, the Viceroyalty of Nueva Granada was re-established and the "Audiencia" of Quito was returned to it until it declared itself independent from Spain. A year later the King of Spain passed the Real Cedula of 1740 where the borders of the Audiencia of Quito would be closer to 4° south of the Equator. The Audiencia of Quito briefly became independent for 3 years after it staged the Quito revolution in 1809, was annexed again to the Spanish Empire in 1812. The Audiencia of Quito was liberated again in 1822 and formerly joined the territories of what is today Ecuador, Venezuela, Colombia and Panama to form the Republic of Gran Colombia.
Independence.
As part of Gran Colombia, the territories of Quito were divided up into districts, departments, and provinces on 25 June 1824 by the "Subdivisions of Gran Colombia". The Audiencia de Quito was divided into 4 departments: Ecuador Department, Guayaquil Department, Azuay Department, and Cauca Department. The departments of Ecuador, Guayaquil, and Azuay united to form the Distrito del Sur. On 13 May 1830 the departments of Ecuador, Guayaquil, and Azuay separated from La Gran Colombia to form a new nation called Ecuador with Juan José Flores as its first president, who tried to incorporate the Department of Cauca, but to no avail.