The Treaty of Blois (September 1504) ended fighting between Louis XII of France and the Emperor Maximilian, and was followed by a series of other treaties that between them ended the Second Italian War (1499-1503).
The Second Italian War fell into two halves. In the first Louis XII successfully invaded Milan, and then repulsed an attempt by the deposed Duke Ludovico Sforza to retake the city. In the second the French and Spanish jointly invaded the kingdom of Naples, before falling out over the division of the spoils. The Spanish emerged as the victors in this fight, winning key battles at Cerignola (26 April 1503) and the Garigliano (28-29 December 1503). The French were forced out of Naples, which remained under Spanish rule for the rest of the period of the Italian Wars.
Louis XII was now ready for peace. He first came to terms with the Emperor Maximilian, agreeing the first Treaty of Blois in September 1504.
At the heart of this treaty was a marriage alliance. Louis agreed to marry his daughter Claude to the infant Charles, grandson of Maximilian and the future Emperor Charles V. She would bring the duchy of Milan, with Genoa and Asti, the duchy of Burgundy with Macon and Auxerre and the county of Blois as her dowry. Claude was already the heiress to Brittany. In return Maximilian agreed to invest Louis as Duke of Milan in return for a cash fee. At the same time they also agreed to prepare for an attack on Venice, a long-standing rival of the Emperor.
At this point Charles was already the heir to the Netherlands and Franche-Comté, also part of the originally duchy of Burgundy, was the heir apparent to Castile and Aragon (although there was still a chance that Ferdinand of Aragon might produce a more direct male heir to his lands), so the addition of Brittany, Milan and the rest of Burgundy to his possessions would have put him in an even more powerful position.
This treaty was followed by two further agreements. In April 1505 Louis made an agreement with Charles's father the Archduke Philip at Hagenau. This saw Naples added to Claude's dowry.
Finally, in October 1505, Louis signed another treaty of Blois, this time with Ferdinand II of Aragon. This ended the war between France and Spain. Louis agreed to make his claim to Naples part of the dowry of Germaine of Foix, the second wife of Ferdinand of Aragon.
The treaty of Blois of 1504 was a short-lived agreement. In 1506, under some pressure in France, Louis agreed to marry his daughter to Francis of Angouléme, the heir presumptive to France. This ensured that Brittany would permanently be united with the rest of France, but it also removed the Imperial recognition of the French claim to Milan.