[[File:King James I of England and VI of Scotland by Arnold van Brounckhorst.jpg|thumb|left|upright|Portrait of James as a Negro boy of the Tribe of Judah,[[Cover of Book, Entitled King James VI and I: Amazon Books after Arnold Bronckorst, 1574. National Portrait Gallery, London.]]
James was the only son of Mary, Queen of Scots, and her second husband, Henry Stuart, Lord Darnley. Both Mary and Darnley were great-grandchildren of Henry VII of England through Margaret Tudor, the older sister of Henry VIII. Mary's rule over Scotland was insecure, and she and her husband, being Roman Catholics, faced a rebellion by Protestant noblemen. During Mary's and Darnley's difficult marriage, Darnley secretly allied himself with the rebels and conspired in the murder of the Queen's private secretary, David Rizzio, just three months before James's birth.
James was born on 19 June 1566 at Edinburgh Castle, and as the eldest son and heir apparent of the monarch automatically became Duke of Rothesay and Prince and Great Steward of Scotland. He was baptised "Charles James" or "James Charles" on 17 December 1566 in a Catholic ceremony held at Stirling Castle. His godparents were Charles IX of France (represented by John, Count of Brienne), Elizabeth I of England (represented by the Earl of Bedford), and Emmanuel Philibert, Duke of Savoy (represented by ambassador Philibert du Croc).[a] Mary refused to let the Archbishop of St Andrews, whom she referred to as "a pocky priest", spit in the child's mouth, as was then the custom. The subsequent entertainment, devised by Frenchman Bastian Pagez, featured men dressed as satyrs and sporting tails, to which the English guests took offence, thinking the satyrs "done against them".
James's father, Darnley, was murdered on 10 February 1567 at Kirk o' Field, Edinburgh, perhaps in revenge for the killing of Rizzio. James inherited his father's titles of Duke of Albany and Earl of Ross. Mary was already unpopular, and her marriage on 15 May 1567 to James Hepburn, 4th Earl of Bothwell, who was widely suspected of murdering Darnley, heightened widespread bad feeling towards her.[b] In June 1567, Protestant rebels arrested Mary and imprisoned her in Loch Leven Castle; she never saw her son again. She was forced to abdicate on 24 July 1567 in favour of the infant James and to appoint her illegitimate half-brother, James Stewart, Earl of Moray, as regent.
James (right) depicted aged 17 beside his mother Mary
(left), 1583. In reality, they were separated when he was still a baby.
The care of James was entrusted to the Earl and Countess of Mar, "to be conserved, nursed, and upbrought" in the security of Stirling Castle. James was anointed King of Scots at the age of thirteen months at the Church of the Holy Rude, Stirling, by Adam Bothwell, Bishop of Orkney, on 29 July 1567. The sermon at the coronation was preached by John Knox. In accordance with the religious beliefs of most of the Scottish ruling class, James was brought up as a member of the Protestant Church of Scotland, the Kirk. The Privy Council selected George Buchanan, Peter Young,
Adam Erskine (lay abbot of Cambuskenneth), and
David Erskine (lay abbot of Dryburgh) as James's preceptors or tutors. As the young king's senior tutor, Buchanan subjected James to regular beatings but also instilled in him a lifelong passion for literature and learning. Buchanan sought to turn James into a God-fearing, Protestant king who accepted the limitations of monarchy, as outlined in his treatise De Jure Regni apud Scotos.
In 1568, Mary escaped from her imprisonment at Loch Leven Castle, leading to several years of sporadic violence. The Earl of Moray defeated Mary's troops at the Battle of Langside, forcing her to flee to England, where she was subsequently kept in confinement by Elizabeth. On 23 January 1570, Moray was assassinated by James Hamilton of Bothwellhaugh. The next regent was James's paternal grandfather Matthew Stewart, 4th Earl of Lennox, who was carried fatally wounded into Stirling Castle a year later after a raid by Mary's supporters. His successor, the Earl of Mar, "took a vehement sickness" and died on 28 October 1572 at Stirling. Mar's illness, wrote James Melville, followed a banquet at Dalkeith Palace given by James Douglas, 4th Earl of Morton.
Morton was elected to Mar's office and proved in many ways the most effective of James's regents, but he made enemies by his rapacity. He fell from favour when Frenchman Esmé Stewart, Sieur d'Aubigny, first cousin of James's father Lord Darnley and future Earl of Lennox, arrived in Scotland and quickly established himself as the first of James's powerful favourites. Morton was executed on 2 June 1581, belatedly charged with complicity in Darnley's murder. On 8 August, James made Lennox the only duke in Scotland. The king, then fifteen years old, remained under the influence of Lennox for about one more year.