This was primarily the result of military insecurity in the latter part of the nineteenth century – I cover these in brief in this answer but feel free to ask any followups if you have them.