In the following years he was pitted against the Duke of Marlborough in the Low Countries. Marlborough's own difficulties with the Dutch and other allied commissioners, rather than Villeroy's own skill, put off the inevitable disaster for some years, but in 1706 Marlborough attacked him and thoroughly defeated him at the Battle of Ramillies. Louis consoled his old friend with this remark: "At our age, one is no longer lucky". However, Louis superseded Villeroy in the command, and Villeroy lived the life of a courtier and, although suspected of being involved in plots, maintained his friendship with Louis. During this time, his secretary was Pierre-François Godard de Beauchamps.