The kingdoms of France and Scotland had traditionally enjoyed a close diplomatic relationship, reflected in a defensive treaty signed between the two kingdoms in 1512. When Henry crossed the English Channel to campaign in France, the King of France activated the treaty, sending arms, money and military advisers to James IV of Scotland to encourage him to fulfil his obligations, in the hope that this would draw English resources away from the invasion of France. James crossed the border with a force of some 35,000 men, including 5,000 French advisers. He was opposed by an English force under the Earl of Surrey. The two sides met on September 9, 1513, near the village of Flodden. The Scottish army was heavily defeated, losing some 9,000 men and many nobles, including King James, the King's illegitimate son, and twelve earls.. Which happened first, the treaty being signed or the battle?