The anarchy in the duchy lasted until 1047, and control of the young duke was one of the priorities of those contending for power. At first, Alan of Brittany had custody of the duke, but when Alan died in either late 1039 or October 1040, Gilbert of Brionne took charge of William. Gilbert was killed within months, and another guardian, Turchetil, was also killed around the time of Gilbert's death. Yet another guardian, Osbern, was slain in the early 1040s in William's chamber while the duke slept. It was said that Walter, William's maternal uncle, was occasionally forced to hide the young duke in the houses of peasants, although this story may be an embellishment by Orderic Vitalis. The historian Eleanor Searle speculates that William was raised with the three cousins who later became important in his career – William fitzOsbern, Roger de Beaumont, and Roger of Montgomery. Although many of the Norman nobles engaged in their own private wars and feuds during William's minority, the viscounts still acknowledged the ducal government, and the ecclesiastical hierarchy was supportive of William.