Merlin is a legendary figure best known as the wizard featured in the Arthurian legend. The standard depiction of the character first appears in Geoffrey of Monmouth's Historia Regum Britanniae, written c. 1136, and is based on an amalgamation of previous historical and legendary figures. Geoffrey combined existing stories of Myrddin Wyllt (Merlinus Caledonensis), a North Brythonic prophet and madman with no connection to King Arthur, with tales of the Romano-British war leader Ambrosius Aurelianus to form the composite figure he called Merlin Ambrosius (Welsh: Myrddin Emrys).
Geoffrey's rendering of the character was immediately popular, especially in Wales. Later writers expanded the account to produce a fuller image of the wizard. Merlin's traditional biography casts him as a cambion: born of a mortal woman, sired by an incubus, the non-human wellspring from whom he inherits his supernatural powers and abilities. The name of Merlin's mother is not usually stated, but is given as Adhan in the oldest version of the Prose Brut. Merlin matures to an ascendant sagehood and engineers the birth of Arthur through magic and intrigue. Later authors have Merlin serve as the king's advisor until he is bewitched and imprisoned by the Lady of the Lake.
The name "Merlin" derives from the Welsh Myrddin, the name of the bard Myrddin Wyllt, one of the chief sources for the later legendary figure. Geoffrey of Monmouth Latinised the name to Merlinus in his works. The medievalist Gaston Paris suggests that Geoffrey chose the form Merlinus rather than the regular Merdinus to avoid a resemblance to the Anglo-Norman word merde (from Latin merda), for faeces.
Many parts of Arthurian fiction include Merlin as a character. Mark Twain made Merlin the villain in his 1889 novel A Connecticut Yankee in King Arthur's Court. He is presented as a complete charlatan with no real magic power, and the character seems to stand for (and to satirise) superstition. Yet at the very last chapter of the book, Merlin suddenly seems to have a real magic power, and he puts the protagonist into a centuries-long sleep (as Merlin himself was put to sleep in the original Arthurian canon).
C. S. Lewis used the figure of Merlin Ambrosius in his 1946 novel That Hideous Strength, the third book in the Space Trilogy. In it, Merlin has supposedly lain asleep for centuries to be awakened for the battle against the materialistic agents of the devil, able to consort with the angelic powers because he came from a time when sorcery was not yet a corrupt art. Lewis's character of Ransom has apparently inherited the title of Pendragon from the Arthurian tradition. Merlin himself is in this depiction described as the last inheritor of an ancient magical tradition brought into what would become Britain by refugees from drowned Atlantis, which was conceived as identical with the Numenor of Lewis' friend Tolkien.
Merlin is also portrayed in the T. A. Barron series The Lost Years of Merlin and The Great Tree of Avalon.
Merlin is a major character in T. H. White's collection The Once and Future King and the related The Book of Merlyn. White's Merlin is an old man living time backward, with final goodbyes being first encounters, and first encounters being fond farewells.
Mary Stewart produced an influential quintet of Arthurian novels, with Merlin as the protagonist in the first three: The Crystal Cave (1970), The Hollow Hills (1973) and The Last Enchantment (1979).
Merlin plays a modern-day villain in Roger Zelazny's short story "The Last Defender of Camelot" (1979), which won the 1980 Balrog Award for short fiction and was adapted into an episode of the television series The Twilight Zone in 1986. Additionally, the last five books in Zelazny's Chronicles of Amber star a character named Merlin, with seemingly little to do with Arthurian legend, though other references to the legend seem to hint at a connection.
Merlin is an important figure in films and television programs, where he functions often as a teacher or mentor figure, a role that he shares with other wizard and wizard-like figures in popular texts, such as Gandalf the White. One of the best known of the film Merlins is the Merlin of the 1963 animated Disney film The Sword in the Stone, based on T. H. White's novel of the same name. Disney's (and White's) version of the character aids and educates King Arthur about various things. He was voiced by Karl Swenson and animated by several of Disney's Nine Old Men, including Milt Kahl, Frank Thomas, Ollie Johnston, and John Lounsbery. Kahl also designed the character, refining the storyboard sketches of Bill Peet. Merlin later appeared in a number of Disney productions, where he has been voiced by several different actors. Merlin, played by Nicol Williamson, has a large role in the 1981 film Excalibur, which is roughly based on Malory's Le Morte D'Arthur. Laurence Naismith appears as Merlyn in the film version of the musical play Camelot, (based on T. H. White's The Once and Future King). In the 1998 miniseries Merlin, the protagonist Merlin (played by actor Sam Neill) battled the pagan goddess Queen Mab. In 1981, the television series Mr. Merlin featured Merlin living undercover in modern-day San Francisco as a mechanic named "Max Merlin," portrayed by Barnard Hughes. In 2006 and 2007, the television series Stargate SG-1 used Merlin and Arthurian legend as major plot points in both Season 9 and 10. Specifically, Merlin is portrayed as an Ancient whose superior knowledge of the universe is the source of many components of the legends. In 2005, Merlin appeared as leader of the Woads of Britton and father to Guinevere in King Arthur. Also in 2007, the film The Last Legion portrayed Merlin (initially called Ambrosinus) as a druid and tutor of both the last Roman Emperor Romulus Augustus Caesar, as well as of his son Arthur.