Although his ship was wrecked in the storm which followed the battle, Valdés and many of his shipmates survived, and thus he was in England when the Peninsular War broke out in Spain in 1808. Immediately released and returning home, Valdés enlisted in the land army and participated in a battle at Espinosa de los Monteros on the staff of General Blake but mainly contented himself with administration and involvement in the Cortes of Cádiz. For this service during the war he was appointed the Captain General in charge of Cadiz, but on the return of Ferdinand VII of Spain, he was stripped of his titles and was lucky to escape death during the repression which followed the restitution of an absolute monarchy.