In the Peninsular War, the Militia regiments and the Ordenanças units had an important role in the defense of the country against the Napoleonic invader army. Still in the 19th century, the Militia units also had an important role in the Liberal Wars, with the majority of those troops fighting on the side of King Miguel. Besides the regular militias, a number of volunteer militia units were formed to fight on both sides of the war.