James Stewart, 1st Earl of Moray (c. 1531 – 23 January 1570) was a member of the House of Stewart as the illegitimate son of King James V of Scotland. At times a supporter of his half-sister Mary, Queen of Scots, he was the regent of Scotland for his half-nephew, the infant King James VI, from 1567 until his assassination in 1570. He was the first head of government to be assassinated with a firearm.
 Moray was born in about 1531, an illegitimate child of King James V of Scotland and his mistress Lady Margaret Erskine, daughter of John Erskine, 5th Lord Erskine, and wife of Sir Robert Douglas of Lochleven. On 31 August 1536, he received a royal charter granting the lands of Tantallon and others. James was appointed Prior of St Andrews, Fife, in 1538. This position supplied his income.
 In May 1553, the imperial ambassador to England, Jean Scheyfve, heard that Mary of Guise planned to make him regent in place of James Hamilton, Duke of Châtellerault. Mary of Guise was the widow of James V and the mother of his only surviving legitimate child, Mary, Queen of Scots, who was living in France at the time and had not yet reached adulthood. Guise herself became regent in 1554.
 On 5 August 1557, Moray, his half-brother Lord Robert, and Lord Home led a raiding party from Edinburgh towards Ford Castle in Northumberland and burnt houses at Fenton before retreating on the approach of an English force led by Henry Percy, 8th Earl of Northumberland. In 1558, James attended the wedding in Paris of his half-sister Mary, Queen of Scots, to the Dauphin of France, who became King Francis II of France. To fund this trip, his mother obtained credit from Timothy Cagnioli, an Italian banker in Edinburgh.
 James became a supporter of the Scottish Reformation. In June 1559, he plucked down the graven images in various churches at Perth. An English commentator praised James for his virtue, manhood, valour and stoutness as a leader of the Protestant Lords of the Congregation.
 Despite their religious differences, Moray became one of the chief advisers to his half-sister Mary, Queen of Scots, after her return from France in 1561. Her return was occasioned by the death of her first husband, King Francis of France. Although James disturbed her priests celebrating mass at Holyroodhouse in September 1561, she made him Earl of Moray and Earl of Mar (the Mar earldom was soon afterwards withdrawn) the following year, both earldoms being new creations. With the lucrative Moray earldom came Darnaway Castle with its medieval hall, notable even then as "verie fayer and large builded." Moray also had a smaller house called Pitlethie near Leuchars in Fife, which his father had used.
 He wrote to Robert Dudley, 1st Earl of Leicester, a favourite of Queen Elizabeth I of England, in January 1562. In October 1562, Moray defeated a rebellion by George Gordon, 4th Earl of Huntly, at the Battle of Corrichie near Aberdeen. The very powerful and wealthy Huntly, who controlled large areas of northeastern Scotland, died immediately after this battle. In 1562, Alistair Gunn son-in-law of John Gordon, 11th Earl of Sutherland, led Gordon's retinue and encountered James Stewart, 1st Earl of Moray, and his followers on the High Street of Aberdeen. The Earl of Moray was the bastard half-brother of Mary, Queen of Scots, as well as the son-in-law of William Keith, 4th Earl Marischal, chief of Clan Keith. It was the custom at the time to yield thoroughfares to the personage of greater rank, and in refusing to yield the middle of the street to Stewart and his train, Alistair publicly insulted the Earl. Stewart soon afterward had him pursued to a place called Delvines, near Nairn. There he was captured by Andrew Munro of Milntown and taken to Inverness, and following a mock trial, he was executed.
 Moray went to Castle Campbell for the wedding of James Stewart, 1st Lord Doune, and Margaret Campbell (d. 1572), sister of the Earl of Argyll, on 10 January 1563. There was a masque involving courtiers and musicians dressed in white taffeta as shepherds. However, Moray became ill and withdrew to Stirling Castle. Mary, Queen of Scots, was also ill for a week.
 Moray opposed the marriage of his half-sister Mary, to Henry Stuart, Lord Darnley, in July 1565, and he embarked upon the unsuccessful Chaseabout Raid, a revolt precipitated by the marriage, together with the Earl of Argyll and Clan Hamilton. He was subsequently declared an outlaw and took refuge in England. It was said that David Rizzio was involved in brokering pardons for Moray and the rebels, which aroused the jealousy of Lord Darnley. Moray returned to Scotland after the murder of Rizzio, pardoned by the Queen, and once more became one of her key advisers. He nonetheless contrived to be away at the time of Darnley's assassination in 1567. He avoided the entanglements of Mary's disastrous marriage to James Hepburn, 4th Earl of Bothwell, which followed the Darnley murder by mere weeks, by removing himself to France.
 Mary was forced into abdication at Lochleven Castle on 24 July 1567, where she was imprisoned for more than nine months. Moray returned to Edinburgh from France on 11 August 1567 by way of Berwick-upon-Tweed. William Cecil, the English Secretary of State, had arranged his transport from Dieppe in an English ship. He was appointed Regent of Scotland on 22 August for the infant King James VI (born 19 June 1566), son of Queen Mary and Lord Darnley. The appointment was confirmed by Parliament in December. To raise money, Moray sent his agent Nicolas Elphinstone to London to sell Mary's jewels and pearls. Moray bought clothes for his lackeys and an African servant called Nageir the Moor in February 1568.
 Mary escaped from Loch Leven on 2 May 1568, and the Duke of Châtellerault and other nobles rallied to her standard. Moray gathered his allies and defeated her forces at the Battle of Langside, near Glasgow, on 13 May 1568. Mary was compelled to flee and decided to seek refuge in England. She could have departed for France, if she had liked, where she retained the status of queen dowager; however, this would have taken more time and resources to arrange. For the subsequent management of the kingdom without Mary as queen, he secured both civil and ecclesiastical peace and earned the title of "The Gude Regent".
 In September 1568, Moray chose commissioners and travelled to York to discuss a treaty with England. During this conference, he produced the Casket letters, which were supposed to incriminate Queen Mary and justify his rule in Scotland. It was later said that a plan to assassinate him at Northallerton, Yorkshire, on his way back had been called off.
 Scotland was now in a state of civil war. Moray moved against the supporters of Queen Mary in their south-west homelands with a military expedition in June 1568 called the 'Raid of Dumfries' or 'Raid of Hoddom.' The Regent's army and the royal artillery was taken to Biggar, where his allies were commanded to muster on 10 June and proceed on to Dumfries. The army was protected by a scouting party led by Alexander Hume of Manderston, and the vanguard was commanded by the Earl of Morton and Lord Home. Behind was the 'carriage' (the artillery train), followed by Moray himself. The Laird of Cessford followed behind, and the army was flanked by the scouting parties of the Lairds of Merse and Buccleuch.
 Along the way, Moray captured houses belonging to supporters of Queen Mary, including Lord Fleming's Boghall, Skirling, Crawford, Sanquhar, Kenmure and Hoddom, where the cannon were deployed, and Annan, where he rendezvoused with Lord Scrope (the Captain of Carlisle Castle), to discuss border matters. Scrope estimated the army to number 6,000 men and returned to Carlisle, where he saw Queen Mary's servants play football on 14 June. Moray then took Lochmaben Castle, which the Laird of Drumlanrig was left to hold, and then captured Lochwood and Lochhouse before returning to Edinburgh via Peebles. At Dumfries, a number of Lord Maxwell's supporters surrendered. Moray was responsible for the destruction of Rutherglen castle, which he burned to the ground in 1569 in retribution against the Hamiltons for having supported Mary at the Battle of Langside.
 In June 1569, Moray went north to Brechin, where he accepted hostages sent by George Gordon, 5th Earl of Huntly. At Dunnotar Castle, he proclaimed that he had "reparit (arrived) in proper person (as Regent) to thir north partis of firm purpose and deliberation to reduce sic as hes neglectit their duty in time bypast ..., intending to use lenitie (leniency) and moderation."
 At Aberdeen, Moray held talks with Huntly himself. At Inverness, on 4 June 1569, Moray met the Highland and Island chiefs with the Earls of Caithness and Sutherland and Lord Lovat. His secretary, John Wood, said "such a power had seldom been seen there," Moray wrote that "the journey is to put down troubles in the north."
 In March 1569 Moray came from Kelso to Liddesdale and spoke to the English border warden, Sir John Forster. He was accompanied by Lord Home, Ker of Cessford, Ker of Ferniehirst, Scot of Buccleuch and 4,000 men. After holding unsatisfactory talks with the local leaders, "the best of the surname men", Moray burned the farmsteads in Liddesdale. He stayed at Mangerton, then had the house blown up with gunpowder and returned to Jedburgh.
 On Thursday, 19 January 1570, Moray was at Stirling Castle, where he had invited the English diplomat Sir Henry Gates and the soldier Sir William Drury, Marshal of Berwick, for dinner in the Great Hall. Later, in his bedchamber, he told the English visitors he would meet them and certain Scottish nobles at Edinburgh on Monday or Tuesday to discuss the rendition of English rebels. Moray was troubled by the problem of Dumbarton Castle, which was held against him by supporters of Mary, Queen of Scots. On 21 January, he sent letters to summon the Earl of Morton, Lindsay and Home to the meeting in Edinburgh.
 Moray was assassinated in Linlithgow on 23 January 1570 by James Hamilton of Bothwellhaugh, a supporter of his half-sister Mary. As Moray was passing in a cavalcade in the main street below, Hamilton fatally wounded him with a carbine shot from a window of his uncle Archbishop Hamilton's house. He was the first head of government to be assassinated by a firearm.
 Moray's body was shipped to Leith, then taken to Holyrood Abbey. Moray was buried on 14 February 1570 in St Anthony's aisle at St Giles' Cathedral, Edinburgh. Seven earls and lords carried his body; William Kirkcaldy of Grange held his standard, and John Knox preached at the funeral. Knox's own prohibition of funeral sermons (on the grounds that they glorified the deceased and displayed distinctions between rich and poor) was waived for the occasion. Moray's tomb was carved by John Roytell and Murdoch Walker, with a brass engraved by James Gray. The contract for the tomb survives. It was written by the chaplain Robert Ewyn, the administrator of the craft of masons and wrights in Edinburgh.
 His wife, Agnes Keith, was buried inside his tomb when she died in 1588.
 Moray was succeeded by his eldest daughter and heir, Elizabeth Stewart, 2nd Countess of Moray, whose husband, James Stewart of Doune, acquired the earldom on their marriage.
 A stained-glass window installed in St. Giles' Cathedral, Edinburgh in the 1880s depicts Moray's assassination and John Knox preaching at his funeral. There is a bas-relief sculpture by Amelia Hill in Linlithgow commemorating the assassination and a Regent Moray Street near the Kelvin Hall in Glasgow.
 The Earl of Moray is depicted in many fictional works which focus on the life and times of Mary, Queen of Scots. These include the following: