The year after his birth, during the Jacobite Rising of 1745, his father attended the court of Charles Edward Stuart at Holyroodhouse, and consequently had to leave Scotland with his wife.
Though a cousin of the Whigs Henry and Thomas Erskine and the independent Francis Charteris, he had been elected as a supporter of William Pitt the Younger and voted with the government, including for parliamentary reform in 1785.
Instead he was appointed (at the suggestion of Henry Dundas) to organise regiments of fencible cavalry in Scotland, and he commanded them in summer camps in 1795, 1796 and 1797, though initially refusing the post owing to rheumatism and depression.
With the approval of the commander-in-chief, Sir Ralph Abercromby, he ensured that military officers in his district would not act as justices of the peace, and in March 1798 he organised the yeomanry and militia of Munster into night patrols, improving discipline for the volunteers and relieving the burden on the regular forces.
When the Irish Rebellion of 1798 broke out, its suppression in Munster was largely the work of Major-General Henry Johnson, who won the Battle of New Ross, Brigadier-General John Moore, who won the Battle of Foulksmills and took Wexford, and the new commander-in-chief Gerard Lake.
Not wanting to be defeated, Denham withdrew his candidacy on 11 July 1802 and Hamilton was returned unopposed in the general election.
At the 1818 general election he was a noted supporter of Sir Alexander Cochrane against Hamilton in Lanarkshire, without success.
[1] Sir James Steuart Denham died at Cheltenham in his ninety-fifth year; at the time of his death he was the senior general in the British Army.