Maximilian did not hesitate to defend the heritage of his wife, culminating in the 1479 Battle of Guinegate, where he defeated the troops of King Louis XI. However, after Mary of Burgundy died on 27 March 1482, leaving the inheritance of her father to Philip, their son, Maximilian had to cope with difficulties to prevail as an accepted regent for their son. To settle the conflict with France, he by the Treaty of Arras agreed to marry his daughter, Archduchess Margaret of Austria, to the Dauphin of France, the later King Charles VIII, bringing the Imperial County of Burgundy to the French crown as her dowry. France retained most of its Burgundian fiefdoms except for the affluent County of Flanders, which passed to Maximilian (but soon rebelled against the archduke).