 When he had succeeded to the throne of the duchy of Bavaria in 1597, Maximilian I had found it encumbered with debt and filled with disorder, but ten years of his vigorous rule effected a remarkable change.The finances and the judicial system were reorganised, a class of civil servants and a national militia founded, and several small districts were brought under the duke's authority.The result was a unity and order in the duchy which enabled Maximilian to play an important part in the Thirty Years' War; during the earlier years of which he was so successful as to acquire the Upper Palatinate and the electoral dignity which had been enjoyed since 1356 by the elder branch of the Wittelsbach family.