Merlin, also known as Myrddin Wyllt, Merlin Caledonensis, or Merlin Sylvestrus lived from about 540 to August 584. He is a figure from Welsh legend who served as a bard before ending his days as a madman, prophet and mystic in the forests of Tweeddale in the Scottish Borders. The wider picture in Scotland at the time is set out in our Historical Timeline.
Merlin is, of course, best known from his role in the Arthurian Legends. These started with Geoffrey of Monmouth's Historia Regum Britanniae or "History of the Kings of Britain", completed in 1138. They have since taken such a hold on popular imagination that separating the fragments of history from the many layers of legend is no easy task. What seems clear, however, is that King Arthur's Merlin as described by Geoffrey of Monmouth was a combination of two separate historical characters. One was our Myrddin Wyllt, and the second was Ambrosius Aurelianus, a war leader of the Romano-British who won an important battle against the Anglo-Saxons in the 400s. The result of this merger was the wizard "Merlin Ambrosius".
The real Merlin, Myrddin Wyllt, was born in about 540 and had a twin sister called Gwendydd. He served as a bard to Gwenddoleu ap Ceidio, a Brythonic or British king who ruled Arfderydd, a kingdom including parts of what are now Scotland and England in the area around Carlisle. Gwenddoleu was killed in the Battle of Arfderydd, near modern Longtown, in 573 during a defeat by King Rhydderch Hael of Strathclyde. An alternative legend places the death of Gwenddoleu at the Battle of Arderyth, or the Battle of Airdrie, in 577. In this version Merlin was awarded a golden torc for his recording of the battle, possibly by King Rhydderch Hael, and he then spent time at the king's fortress at Dumbarton Castle. It is said that Merlin subsequently went mad, retreating to live as a prophet and recluse in the forests of Tweeddale.
In August 584 Merlin, later also referred to as Lailoken, is said to have encountered St Mungo or St Kentigern near the site of what is now Stobo Kirk. The result was Merlin's conversion to Christianity by Kentigern. According to a later chronicler, Kentigern was told by Merlin that he had foreseen his own death by falling, stabbing, and drowning. Late on the day of his conversion Merlin was chased by a group of shepherds and as a result fell off a cliff into a river, where he was impaled on a stake securing a fisherman's net and drowned. Merlin is believed to have been buried beside a thorn tree at Drumelzier, near the River Tweed and close to a tiny settlement called Merlindale. There is no record of his ever meeting the best Scottish candidate for the basis of the legend of King Arthur, Artuir mac Áedáin, but the two were contemporaries.
One of the oddities of this and other stories from south west Scotland is why they should have been preserved in Welsh rather than Scottish folklore. The answer is that the British Kingdom of Strathclyde was much more aligned, both culturally and linguistically, with Wales than with any part of modern Scotland. The Kingdom of Strathclyde was extinguished almost without trace five centuries after the era we are talking about here, and the theory is that as Brythonic or British culture contracted back towards its Welsh heartland it took with it the folklore of Strathclyde.