William was the son of the unmarried Robert I, Duke of Normandy, by his mistress Herleva. His illegitimate status and his youth caused some difficulties for him after he succeeded his father, as did the anarchy which plagued the first years of his rule. During his childhood and adolescence, members of the Norman aristocracy battled each other, both for control of the child duke, and for their own ends. In 1047, William was able to quash a rebellion and begin to establish his authority over the duchy, a process that was not complete until about 1060. His marriage in the 1050s to Matilda of Flanders provided him with a powerful ally in the neighbouring county of Flanders. By the time of his marriage, William was able to arrange the appointment of his supporters as bishops and abbots in the Norman church. His consolidation of power allowed him to expand his horizons, and he secured control of the neighbouring county of Maine by 1062.