Prior to Confederation in 1867, residents of the colonies in what is now Canada served as regular members of French and British forces and in local militia groups. The latter aided in the defence of their respective territories against attacks by other European powers, Aboriginal peoples, and later American forces during the American Revolutionary War and War of 1812, as well as in the Fenian raids, Red River Rebellion, and North-West Rebellion. Consequently, the lineages of some Canadian army units stretch back to the early 19th century, when militia units were formed to assist in the defence of British North America against invasion by the United States.