The vegueria (Catalan pronunciation: [bəɣəˈɾi.ə], Western Catalan: [beɣeˈɾi.ɛ]; pl. vegueries) was the feudal administrative territorial jurisdiction of the Principality of Catalonia (to the Crown of Aragon) during the Middle Ages and into the Modern Era until the Nueva Planta decrees of 1716. The vegueria was headed by a veguer (Latin: vigerius) and its office was called a vigeriate (Latin: vigeriatus).
Vegueries were also in place during the Crown of Aragon dominion of Sardinia, and –briefly– during the same in the Duchy of Athens .
The origins of the vegueria go back to the era of the Carolingian Empire, when vicars (Latin: vicarii, singular vicarius) were installed beneath the counts in the Marca Hispanica. The office of a vicar was a vicariate (Latin: vicariatus) and his territory was a vicaria. All these Latin terms of Carolingian administration evolved in the Catalan language even as they disappeared in the rest of Europe. The Catalan terms were even subsequently Latinised: vicarius → vigerius.
The original functions of the vigeriate were feudal and it was probably initially hereditary. The veguer was appointed by his feudal lord, the count, and was accountable to him. He was the military commander of his vegueria (and thus keeper of the publicly owned castles), the chief justice of the same district, and the man in charge of the public finances (the fisc) of the region entrusted to him. As time wore on, the functions of the veguer became more and more judicial in nature. He held a cort del veguer or de la vegueria with its own seal. The cort had authority in all matter save those relating to the feudal aristocracy. It commonly heard pleas of the crown, civil, and criminal cases. The veguer did, however, retain some military functions as well: he was the commander of the militia and the superintendent of royal castles. His job was law and order and the maintenance of the king's peace: in many respects an office analogous to that of the sheriff in England.