Together with James Stanhope he succeeded in conquering Madrid in 1710, after previously gaining victories at Almenar and Saragossa. In December, however, he was forced to leave the city by the lack of support by its inhabitants for the Habsburg pretender. After the subsequent defeats at the Battle of Brihuega and the Battle of Villaviciosa (1710), he had to pull back to Catalonia, where he was made viceroy when Archduke Charles returned to Austria.