James I, King of Scots, was the youngest of three sons of King Robert III and Annabella Drummond and was born probably in late July 1394 in Dunfermline Palace. By the time he was 8–years–old both of his elder brothers were dead—Robert had died in infancy, but David Stewart, Duke of Rothesay, died suspiciously in Falkland Castle while being detained by his uncle, Robert Stewart, Duke of Albany. Although parliament exonerated Albany, fears for James's safety grew during the winter of 1405–6 and plans were made to send him to France. In February 1406, James and nobles close to his father clashed with supporters of Archibald, 4th Earl of Douglas, forcing the prince to take refuge on the Bass Rock in the Firth of Forth. He remained there until mid-March, when he boarded a vessel bound for France, but while off the English coast, pirates captured the ship on 22 March and delivered James to Henry IV of England. A few days later, on 4 April Robert III died, and the 12–year–old uncrowned King of Scots began his 18-year detention.
James was given a good education at the English court, where he developed respect for English methods of governance and for Henry V to the extent that he served in the English army against the French during 1420–1. Murdoch Stewart, James's cousin and Albany's son, a captive in England since 1402 was traded for Henry Percy, Earl of Northumberland in 1416. Eight more years passed before James was ransomed by which time Murdoch had succeeded his father to the dukedom and the governorship of Scotland. James married Joan Beaufort, daughter of the Earl of Somerset in February 1424 shortly before his release in April when they journeyed to Scotland. It was not altogether a popular re-entry to Scottish affairs, since James had fought on behalf of Henry V and at times against Scottish forces in France. Additionally, his £40,000 ransom meant increased taxes to cover the repayments and the detention of Scottish nobles as collateral. Despite this, James also held qualities that were admired. The contemporary Scotichronicon by Walter Bower described James as excelling at sport and appreciative of literature and music. Unlike his father and grandfather he did not take mistresses, but had many children by his consort, Queen Joan. The king had a strong desire to impose law and order on his subjects, but applied it selectively at times.