Teniente a guerra (roughly translated into English as "War lieutenant") was a title used in times of the Spanish colonial Empire to describe a position exercising duties similar to those exercised by a town or city mayor today (2019).
A teniente a guerra was a position that combined the duties of mayor, military lieutenant and justice of the peace.
[5] People holding this position were authorized and empowered to perform the following duties: provide for public safety, levy contributions, collect taxes, carry out orders and circulars of the governor, and administer justice.
When the teniente a guerra was not available (sickness, travel, incapacity or death) they were substituted by a sargento mayor.
The urban militia the sargento mayor led was in charge of patrolling and guarding the urban areas, capturing criminals, delivery of official documents, transportation and movement of prisoners, opening and maintenance of trails, town policing, and the protecting and defending the perimeter to avoid contraband.