 Margaret inherited Flanders and Hainault in 1244 and immediately the War of the Succession of Flanders and Hainault began between William and his brothers, the Dampierre claimants, and the children of Margaret's first marriage to Bouchard of Avesnes.Margaret favoured William and declared him her heir.In 1246, Louis IX of France intervened to arbitrate the conflict and declared Flanders to William and Hainault to John I of Avesnes.