 Between the 12th and 16th centuries, the municipal militias – composed of spearmen, pikemen, horsemen, slingers, javelineers, archers, crossbowmen and later arquebusiers – constituted the main component of the Portuguese Royal Army, together with smaller military forces from the King, the military orders and the feudal lords.After some failed previous attempts, in 1570 King Sebastian of Portugal created the "Ordenanças", a centrally managed military territorial organization that would replace the municipal militias and became the basis of a national army.After 60 years of foreign domination (1580–1640), the "Ordenanças" were reorganized for the Portuguese Restoration War.