 John I of Avesnes and William of Dampierre, half brothers, fought between themselves until King Louis IX intervened in 1246.Louis gave Hainault (technically not his to give) to John I of Avesnes and Flanders (indeed his vassal) to William of Dampierre.Margaret, in light of this judgement, gave the government of Flanders over to William of Dampierre in 1247.