[2] Called the Black (la Noire) due to her scandalous life, the children of both her marriages disputed the inheritance of her counties in the War of the Succession of Flanders and Hainault.
After her sister's marriage with Infante Ferdinand of Portugal, Margaret was placed under the care of Bouchard of Avesnes, Lord of Etroen and a prominent Hainaut nobleman, who was knighted by Baldwin IX before he parted to the Crusades.
In 1215, at the Fourth Council of the Lateran, the Pope annulled the marriage on this ground; however, Margaret and Bouchard refused to submit and they took refuge at the Castle of Houffalize in the Ardennes under the protection of Waleran, Count of Luxembourg.
[7] While he was in Rome to obtain forgiveness and the orders that would make his union legitimate, Joan took advantage of this to convince Margaret (who after Bouchard's capture came to live at her court, leaving her two sons in France under custody[8]) to contract a new wedding.
The disputes regarding the validity of the two marriages and the legitimacy of Margaret's children by each husband continued for decades, becoming entangled in the politics of the Holy Roman Empire and resulting in the long War of the Flemish Succession.
[13] This would seem to have settled the matter, but neither party accepted the solomonic decision of the French King, while responding to the spirit of fairness of the monarch, it had a political effect clearly advantageous for the interests of France, to dislocate the county, and served to avoid war.
[14] However, in 1248 John of Avesnes took advantage of the departure of Louis IX and William of Dampierre for the Crusades, to initiate war against his mother, taking Hainaut and Alost with other surrounding Flemish lands.
[13] Margaret, thinking that the inheritance disputes were finally over after her son William of Dampierre paid homage for Flanders as her co-ruler to both Louis IX (in October 1246) and Emperor Frederick II (in 1248), made the political mistake of obtaining from the Pope, in 1251, the legitimation of both John and Baldwin of Avesnes; this gave them rights of birth over the Counties.
A civil war followed, which ended when the Avesnes forces defeated and imprisoned Guy of Dampierre (who had succeeded his brother as co-ruler of Flanders) at Westkappel, on the island of Walcheren, in July 1253.
[17]Because the Avesnes heir, her grandson John II was still under-age, Margaret managed to recover the government of Hainaut, while in Flanders she remained co-ruler with her son Guy of Dampierre until 29 December 1278, when she abdicated in his favor.
Townspeople who depended on the textile trade pressured the Countess and her son Guy to enter into negotiations with the English; henceforth the Flemish no longer dominated the transport of goods between the continent and England.