When Joseph accepted the crown of Spain in 1808, Merlin went with him and was assigned to Joseph's Spanish army as a general of division. He fought at Talavera, Almonacid and Ocaña in 1809. After re-entering the French service in 1814 he led a cavalry division at Gué-à-Tresmes, Laon, Reims, Fère-Champenoise and Paris. In 1815 he led soldiers on the Rhine. He held peacetime commands until 1825 when he retired, but was again employed from 1830 to 1836. His surname is one of the names inscribed under the Arc de Triomphe, on Column 30.