Derived from the Arabic al-wazir (vizier), this word refers to a justice officer in Spain or within Latin American countries or regions with Spanish influence. The term was first used as far back as 1670, according to Merriam-Webster dictionary. It seemed applicable to constables, judges, and sheriffs.
Historically, an alguacil executed decisions of an alcalde (local judge), and was permitted to carry weapons during town patrols. However, an alguacil couldn’t run a business or hold other office that might conflict with their responsibilities.