"Mary Hamilton," or "The Four Marys" is a well-known 16th-century ballad from Scotland based on an apparently fictional incident about a lady-in-waiting to a Queen of Scotland. In all versions of the song, Mary Hamilton is a personal attendant to the Queen of Scots, but precisely which queen is not specified. She becomes pregnant by the Queen's husband, the King of Scots, which results in the birth of a baby. Mary kills the infant – in some versions by casting it out to sea or drowning, and in others by exposure. The crime is seen and she is convicted. The ballad recounts Mary's thoughts about her life and her impending death in a first-person narrative. Although the story is usually set in Scotland, the historical setting most closely matches the legend of Maria Danilova Gamentova, daughter of an ex-patriot branch of the Clan Hamilton established in Russia by Thomas Hamilton during the reign of Tsar Ivan IV (1547-1584). A lady in waiting to Tsarina Catherine, second wife of Tsar Peter I "The Great" (who later succeeded him as Catherine I), Mary Hamilton was also the Tsar's mistress. She bore a child in 1717, who may have been fathered by the Tsar but whom she admitted drowning shortly after its birth. She also stole trinkets from the Tsarina. For the murder of her child, she was executed in 1719.
It appears in F. J. Child's English and Scottish Popular Ballads (#173) (28 versions) and in the Roud Index of Folk Song (#79).
The best known recorded version is probably by Joan Baez. This melody is close to her recording.