The
medieval kings of León, Castile, and Aragón were often unable to maintain public peace, protective municipal leagues began to emerge in the twelfth century against bandits and other rural criminals, as well as against the lawless nobility or mobilized to support a claimant to the crown. These organizations were individually temporary but became a long-standing fixture of Spain. The first recorded case of the formation of an
hermandad occurred when the towns and the peasantry of the north united to police the
pilgrim road to
Santiago de Compostela in
Galicia, and protect the pilgrims, a major source of regional income, against
robber knights. With the countryside virtually everywhere effectively in the hands of nobles, throughout the High Middle Ages such brotherhoods were frequently formed by leagues of towns to protect the roads connecting them. The
hermandades were occasionally co-opted for dynastic purposes. They acted to some extent like the
Fehmic courts of
Germany. Among the most powerful was the league of northern Castilian and
Basque ports, the
Hermandad de las Marismas:
Toledo,
Talavera, and
Villa Real. As one of their first acts after the
War of the Castilian Succession,
Ferdinand and Isabella "brought peace by the brilliant strategy of organizing rather than eliminating violence;" they established a centrally organized and efficient Holy Hermandad (
Santa Hermandad) with themselves at its head. They adapted the existing form of the
hermandad to the purpose of creating a general police force under the direction of officials appointed by themselves, and endowed with large powers of summary jurisdiction, even in capital cases. The rough and ready justice of the
Santa Hermandades became famous for brutality. The original
hermandades continued to serve as modest local police units until their final suppression in 1835.
20th century The principal forces of public order and security as of 1988 were the
Civil Guard, founded in 1844, and the
National Police Corps, founded in 1986. The Civil Guard, fortified by nearly a century and a half of tradition, was a highly disciplined paramilitary body with close links to the
Spanish army. As it evolved, it served mainly as rural police to protect property and order and to reinforce the authority of the central government. Under
Francisco Franco, a tripartite system of police was formalized: the Civil Guard in rural areas; the Armed and Traffic Police (renamed the National Police in 1979), which fulfilled normal police functions in communities with a population of more than 20,000; and the Higher Police Corps of plainclothes police with responsibility for investigating crimes and political offenses. Separate municipal police forces under the control of local mayors were concerned mainly with traffic control and with enforcement of local ordinances. Under the Statutes of Autonomy of 1979, the
Basque Country and
Catalonia were granted authority to form or restitute their own regional police forces (
Ertzaintza and ''
Mossos d'Esquadra'', respectively). Subsequently, ten of the seventeen autonomous regions were extended the right to create their own forces, but, as of 1988, only three areas—the Basque Country, Catalonia, and
Navarre—had developed regional police units. The 1986 organic law defined limits of competence for regional police forces, although the restrictions imposed did not apply to the existing forces in Navarre and the Basque Country (who had already replaced duties from the Civil Guard, such as intercity traffic enforcement) and applied only in part to those in Catalonia.
21st century In 2000, the catalan police acquired intercity traffic enforcement duties from the Civil Guard. And, in 2008, it acquired public safety competencies in all of its territory. From that year, the National Police and Civil Guard in the Basque Country and Catalonia only handle documentation expedition, immigration enforcement, coastal protection and ports and airports protection. In 2008, the
Canary Islands created its own regional police aswell (
Canary Police General Corps), however to this day it has not replaced the national police forces and acts as a cooperation agent. During the
2017 Spanish constitutional crisis, a large number of National Police and Civil Guard officers were deployed to Catalonia to stop the
independence referendum. The national forces faced several accusations of repression and
police brutality. 1.066 people resulted injured and 633 reported the police. At least 95 police officers were investigated, but were later granted amnesty by the Spanish government. After the
general election of 2023, the progressive party
PSOE required the votes from the small-sized regional parties in order to form government. Among other agreements, the party agreed to transfer more competencies and give more duties to the regional police forces. Following
Pedro Sánchez re-election, between 2024 and 2025, the Spanish Government announced it would transfer maritime policing, protection of ports and airports and immigration enforcement to the basque and catalan police, implying the practical complete disappeareance of the National Police and the Civil Guard from Catalonia and the Basque Country. These agreements were heavily critiqued by nationalist parties and national police forces
unions. Even though these agreements were registered as law proposals, they have not been passed yet due to legal and parliamentary disputes. In 2025, the navarrese police acquired intercity traffic enforcement duties from the Civil Guard, after a polemic period of judicial disputes. ==Firearms==