Both his parents were Catholic, but some relatives on his father's as on his mother's side were Protestants. His grandfather, James Hamilton, 1st Earl of Abercorn, was a Protestant, but his father and all his paternal uncles were raised as Catholics due to the influence of his paternal grandmother, Marion Boyd, a recusant. Some branches of the Hamilton family were Protestant, such as that of his father's second cousin Gustavus (1642–1723), who would become the 1st Viscount Boyne. His mother's family, the Butlers, were generally Catholic with the notable exception of the future 1st Duke of Ormond, his maternal uncle. His eldest brother, James, would turn Protestant when marrying Elizabeth Colepeper in 1661, and his son, also called James Hamilton, would fight on the other side during the Siege of Derry. His brother Thomas seems to have made the same choice as he became a captain in the Royal Navy.