James IV, born on 17 March 1473, was 15 when he was forced him to ride to the Battle of Sauchieburn where his father was killed.
For the rest of his life he wore an iron belt as a penance.
For the first time in a century, Scotland had a king who was able to start ruling for himself at once for, as Erasmus once commented, 'He had wonderful powers of mind, an astonishing knowledge of everything, an unconquerable magnanimity and the most abundant generosity.'
He spoke Latin (at that time the international language), French, German, Flemish, Italian, Spanish and some Gaelic, and took an active interest in literature, science and the law, even trying his hand at dentistry and minor surgery.
With his patronage the printing press came to Scotland, and the Royal College of Surgeons in Edinburgh, St Leonard's College, St Andrews and King's College, Aberdeen were founded.
He commissioned building work at the royal residences of Linlithgow Palace, Edinburgh Castle and Stirling Castle, and developed a strong navy led by his flagship, the Great Michael, said to be the largest vessel of the time.
Under James' vigorous rule, he extended royal administration to the west and north - by 1493, he had overcome the last independent lord of the Isles.
To begin with, relations with England were difficult: in 1495, James supported the pretender Perkin Warbeck in his claim to the English throne. Even so, he was anxious to maintain peace with England and concluded a peace treaty in 1502.
After the death of his mistress Margaret Drummond, who was poisoned along with her sisters, presumably to prevent her from marrying the king, James accepted Henry VII's offer of his daughter Princess Margaret Tudor as a bride.
'The Marriage of the Thistle and the Rose' took place at Holyrood on 8 August 1503. Although this match had great significance in the long term (after the death of Elizabeth I of England and the end of the Tudor dynasty, the two thrones were inherited by James' and Margaret's great-grandson James I and VI), it did not at once improve Anglo-Scottish relations.
When Henry VIII joined the Holy Alliance against France, and England invaded France in 1513, James felt that he must assist Scotland's old ally under the 'Auld Alliance'.
He led his army - one of the largest ever to cross the border - south. The English forces, led by Lord Surrey, inflicted a crushing defeat. James and many of his nobles died at the head of his men in the disastrous Battle of Flodden, three miles south-east of Coldstream, Northumberland on 9 September 1513.