James Hartley was one of the great British heroes of the military campaigns against the Mahrattas in western India which helped consolidate the British presence in the region.
Hartley had been commissioned into the Bombay Regiment of the East Indian Army in 1764. By 1768 he had attained the rank of Lieutenant and in October 1770 he was made aide-de-camp to the governor of Bombay and was later promoted to the rank of Captain, receiving the command of the fourth Battalion of Bombay Sepoys. At the outbreak of the first Mahratta war in 1775, Hartley was sent to co-operate with Colonel Keating in Guzerat, but the Bengal government ended the war the following August and Hartley returned to Bombay with the rest of the English forces. The resumption of war three years later provided Hartley with a greater opportunity to demonstrate his military ability. The Bombay government decided to send an army across the Konkan (the lowlands of Western India between the sea and the mountain range that run parallel to it known as the 'Ghauts' or 'Ghats') to cross the Ghauts and march on Poonah. Following the death of Captain Stewart in a skirmish, Hartley succeeded him in the command of the six companies of grenadiers. The British army had reached Tullygaom, only eighteen miles from Poonah, when it was decided to retreat on account of the threat posed by the increasing numbers of Mahrattas. Hartley, whose reserve formed the rearguard, distinguished himself in repelling a strong Mahratta assault against the retreating army.
Hartley was universally regarded as having saved the English army from annihilation and was promoted to the rank of Lieutenant Colonel and appointed to the command of the European infantry on the Bombay establishment.
The following year, Hartley led the storming party which captured Ahmeddabad and was then recalled to Bombay and entrusted with the task of defending the Konkan which was of great strategic importance as the source of supplies for Bombay. He defeated a party of Mahrattas who had besieged the fortified post of Kallian to the North-East of Bombay and another attack at Mullungurgh, securing the Bhore Ghaut, the central part of the mountain chain opposite Bombay for the English. Hartley also played a key role in the successful siege of the fortress of Bassein; one of the strongest and most important fortresses under the Mahratta power.
Hartley was still acting as military commandant in the Konkan when he received a despatch from London declaring his recent promotion to Lieutenant Colonel informal, until other officers senior to him were promoted. As a result of this Hartley resigned from the service of the East India Company army and travelled back to England in December 1781 to put his case before the Court of Directors of the East India Company. Although the Company refused to alter its position it recommended him to the King, who conferred upon him the Lieutenant-Colonelcy of the 75th Highland Regiment which had been raised by Colonel Robert Abercromby, at the expense of the East India Company, for service in India.
Hartley returned to India in April 1788 with his regiment, and on the outbreak of war with Tippoo, Sultan of Mysore, in 1790, he received command of a detachment sent to the coast of Cochin to aid the Company's ally, the Rajah of Travancore. He achieved a spectacular victory at Calicut, against superior forces under Tippoo's general, Hussein Ali. Hartley was later made commander of the forces in the south-west provinces ceded by Tippoo.
In March 1794, Hartley was promoted to the rank of Colonel, and returned for a time to England. In May 1796 he was made a Major General, appointed to the staff in India and he returned to Bombay in 1797. In addition to his military rank, he was also appointed supervisor and magistrate for the province of Malabar. Hartley continued to play a key role in the Bombay army fighting against Tippoo, until the successful storming of Seringapatam, Tippoo's capital, in May 1799. At this point, Hartley returned to his civil duties in Malabar, but died after a short illness on 4 October of that year at Cannanore.
Hartley, who had left India for England in December 1781, is recorded as having sat to Romney in 1783, 1784, and 1786, and in 1789 a payment of £105 was recorded by Romney: 'S.Hartley, Esq., for the full length portrait of Col. Hartley, with a horse'. Romney's portrait shows Hartley in a heroic pose, in the uniform of a Field Officer (a term encompassing Majors and Lieutenant-Colonels) of the 1st Bombay European Regiment, reflecting the reputation the sitter had won for himself in India. In the distance a column of soldiers can be made out apparently coming down a mountain, presumably alluding to the mountain ranges running parallel to the coast of western India and Hartley's military feats there.