As one of their first acts after end of the War of the Castilian Succession in 1479, Ferdinand and Isabella established the centrally organized and efficient Holy Brotherhood (Santa Hermandad) as a national police force. They adapted an existing brotherhood to the purpose of a general police acting under officials appointed by themselves, and endowed with great powers of summary jurisdiction even in capital cases. The original brotherhoods continued to serve as modest local police-units until their final suppression in 1835.
Is there an answer to this question (If it cannot be answered, say "unanswerable"): What war ended in 1479?
War of the Castilian Succession