He joined the army in 1796 as an officer in the Royal Engineers and served at Hanover (1805) and at the Battle of Copenhagen (1807). He served with distinction during the Peninsular War from May 1809 to April 1814 and was present at the battles of Talavera (1809), Bussaco (1810), Vittoria (1813), Pyrenees (1813), Nive (1813), Orthez (1814) and Toulouse (1814). He was captured at the Battle of Porto (1809) but managed to escape.