In 1873 the government of Canada created a Department of the Interior and a national police force called the North-West Mounted Police. The purpose was to establish law and order in the great North-West, which is what most of the lands between Ontario and British Columbia were called at this time. After taking the land over from the Hudson's Bay Company in 1870 the government felt it had to replace the company's courts and law enforcement system with its own.
The urgency of building a police force was increased with the Cypress Hills Massacre in which American whiskey traders massacred 36 Assiniboine people near what is today the southern part of the border between Alberta and Saskatchewan. News of this atrocity reached the east and the public outcry against it prompted serious recruiting for the NWMP. The men were quickly sent out, dividing into two branches - one that went north to Fort Edmonton, one that headquartered around Fort Whoop-Up, near present-day Lethbridge, Alberta. The force was patterned after a British constabulary and wore bright red uniforms and white hats.
The NWMP were representative of a major difference between Canada and the United States as both countries settled their western lands. In Canada the police were there before the settlers came, ensuring an atmosphere of law and order and collective responsibility for justice. In the United States, the west was settled before the police came, giving rise to its image as the "Wild West" - a place where strong individuals exercised their own law - or tyranny, depending which end of it you were on.
The NWMP also helped protect the Indigenous people and smoothed relations between them and the government agents sent to sign treaties during the 1870s and 80s. Colonel James Macleod, commissioner of the force from 1876 to 1880, was a good friend of Chief Crowfoot of the Blackfoot nation. The Mounties were used against the Métis, however, during the Northwest Rebellion of 1885. The local force was increased from 80 to 200 men and an additional militia of 5000 was recruited in Ontario and Quebec and transported on the newly built railway, arriving in just five days.
The Mounties were also instrumental in holding the Yukon border from infringement by the Americans during the Klondike Gold Rush and they kept law and order during the heyday of the gold frenzy. There was plenty of unsaintly activity in Dawson City, but no lynch mobs or gangsters, no guns, and strict Sunday closings for saloons and houses of prostitution.
In 1904 "Royal" was added to the name of the North-West Mounted Police (the RNWMP) and in 1920, the force merged with the Dominion Police to form the Royal Canadian Mounted Police.