He joined the British Army in 1776 as an ensign in the 51st Regiment of Foot then based in Menorca. He first saw action in 1778 during the American War of Independence as a lieutenant in the 82nd Regiment of Foot, which was raised in Lanarkshire for service in North America by the 8th Duke of Hamilton. From 1779 to 1781 he was garrisoned at Halifax, Nova Scotia. In 1779, he distinguished himself in action during the Penobscot Expedition in present-day Maine, when a small British detachment held off a much larger American force until reinforcements arrived.