At first, newly-occupied land on the Plains was federal territory (it belonged to the US government) and was administered by a governor, three judges and a US marshal.
When the area reached a population of 5,000, it became a territory, with - in addition - locally-elected sheriffs, who could deal with local criminals. New territories were notoriously lawless.
Miners in the mining towns set up miners' courts, which settled local matters such as disputed claims, but were powerless to stop gangs of outlaws or rustlers.
In many areas, local citizens set up vigilante groups, who dished out summary justice to people suspected of crimes.
The gunfight at the OK Corral took place near here on 26 October 1881.
When the population reached 60,000, the territory became a state, with its own laws, government and finances, although there was still a US marshal with responsibility for criminals who broke federal laws. Slowly, helped by improved communications (for instance the telegraph), law and order was established.
Among the lawmen who helped achieve this were Pat Garrett (who shot Billy the Kid) and Wyatt Earp (famous for his shoot-out with the Clanton gang at the OK Corral).