From the age of four until he was fourteen the boy was brought up in France, where his family had fled after the execution of Charles I. The fact that, like his father, he was a Roman Catholic, prevented his receiving the political promotion he might otherwise have expected on the Restoration of the monarchy in 1660.

Hamilton appeared in a performance of Philippe Quinault's ballet, the Triomphe de l'Amour, at Saint-Germain-en-Laye in 1681. In 1685, on the accession of James II to the British throne, Hamilton was one of a small group of Catholic professional soldiers brought in to replace Protestants purged from the officer corps of the British army in Ireland. Others were his brother Richard, who broke parole to do so; Patrick Sarsfield; and Justin McCarthy.[2]

Hamilton was appointed governor of Limerick to succeed Sir William King, and arrived on 1 August. Shortly he demonstrated his Catholicism when he went publicly to mass. He was at this time lieutenant-colonel of Sir Thomas Newcomen's regiment, but was advanced, on the recommendation of Henry Hyde, 2nd Earl of Clarendon, to the command of a regiment of dragoons and sworn of the privy council in 1686. With the rank of major-general he commanded the dragoons, under Justin McCarthy, Viscount Mountcashel, at the siege of Enniskillen. In the battle of Newtownbutler on 31 July 1689, serving under MacCarthy, Hamilton was wounded in the leg at the beginning of the action, and his raw levies were routed with great slaughter. Hamilton succeeded in making good his escape.[3] Hamilton was considered to have led his dragoons into an ambush by over-confidence; and to have made minimal efforts to extricate them. With Captain Lavallin from Cork he served as scapegoat for the defeat, being subjected to a court martial under General von Rosen. Given his influence Hamilton was acquitted, while the hapless Lavallin was shot;[4] but the reputations of the Hamilton brothers had suffered terminal damage with the French.[5]

It is not clear when or how he obtained his title of count. The rest of his life appears to have been spent chiefly at the court of St. Germain-en-Laye,[3] with visits to the châteaux of his friends. With Ludovise, duchesse du Maine, he became an especial favourite, and it was at her seat at Sceaux that he wrote the Mémoires that made him famous. He died at St Germain-en-Laye.

The Mémoires du comte de Gramont made Hamilton one of the classical writers of France. The tone of the work, however, is now thought equivocal. By highlighting the brilliance of the London Restoration court, it threw into relief the nature of the exiled Stuart court which contrasted so strongly with that of Charles II. It has even been said to share something with the polemic written against the court of James II at St Germain by John Macky.[6]

The work was said to have been written at Gramont's dictation, but Hamilton's share is obvious. Written between 1704 and 1710, the work was first published anonymously in 1713 (apparently without Hamilton's knowledge) under the rubric of Cologne, but it was really printed in the Netherlands. An English translation by Abel Boyer appeared in 1714;[7] over 30 further editions then appeared.[8]

In imitation and satiric parody of the romantic tales which Antoine Galland's translation of The Thousand and One Nights had brought into favour in France, Hamilton wrote, partly for the amusement of Henrietta Bulkley, sister of Anne, Duchess of Berwick, to whom he was much attached, four ironic and extravagant contes, Le Bélier, Fleur d'Epine, Zeneyde and Les quatre Facardins. The saying in Le Belier, "Belier, mon ami, tu me ferais plaisir si tu voulais commencer par le commencement," passed into a proverb. These tales were circulated privately during Hamilton's lifetime, and the first three appeared in Paris in 1730, ten years after the death of the author; a collection of his Œuvres diverses in 1731 contained the unfinished Zeneyde. An 1849 omnibus entitled Fairy Tales and Romances contained English translations of all his fiction.

Hamilton was also the author of some songs, and interchanged amusing verses with the Duke of Berwick. In the name of his niece, the countess of Stafford, Hamilton maintained a witty correspondence with Lady Mary Wortley Montagu.

^The French one of Renouard is notable (1812), forming part of a collected edition of Hamilton's works; others are Gustave Brunet's (1859), and among the English, Edwards's (1793), with 78 engravings from portraits in the royal collections at Windsor and elsewhere. There are also A. F. Bertrand de Moleville's (2 vols, 1811), with 64 portraits by E. Scriven and others, and Gordon Goodwin's (2 vols., 1903). Peter Quennell's translation (Routledge, 1930) includes extensive commentary by Cyril Hughes Hartmann. The original edition was reprinted by Benjamin Pifteau in 1876.