The Valeyard

The Valeyard was introduced as "an amalgamation of the darker side of the Doctor's nature", according to. The Master explained that during the Doctor's 12th regeneration, the Doctor's darker side became personified.

He sought to take the Sixth Doctor's seven remaining regenerations and have them for himself, eliminating his "other self" to be free of his influence, as well as murdering the Time Lords present at the trial. He was stopped by the Doctor, but escaped being captured. (TV: The Ultimate Foe)

First meeting with the Doctor
On behalf of the corrupt High Council, seeking to cover up the Ravalox affair that the Sixth Doctor had accidentally uncovered, the Valeyard acted as the prosecutor in the Doctor's trial in exchange for his seven remaining regenerations. (TV: The Ultimate Foe) Keeping his end of the bargain, the Valeyard presented extracts from the Matrix depicting recent past events in the Doctor's life as evidence of the Doctor violating the Time Lords' non-interference policy. (TV: The Mysterious Planet, TV: Mindwarp)

Unbeknownst to the Time Lord jury present at the trial, the Valeyard had tampered with the Matrix extracts to show the Doctor in the worst possible light and steer the trial to a guilty verdict. He created the impression the Doctor had betrayed his companion, Peri Brown, to save himself. (TV: Mindwarp) He also added the charge of genocide of the Vervoids despite their artificial nature. (TV: Terror of the Vervoids) However, the Master eventually stepped in after taking delight in seeing the Doctor's plight, and revealed the Valeyard's motives. The Valeyard escaped into the Matrix via the Seventh Door, which he opened with a copy of the Key of Rassilon. He was pursued and finally defeated by the Sixth Doctor when he tried to use a particle disseminator to destroy the court at the Doctor's trial. The Doctor programmed the disseminator to feed back into the Matrix and escaped before the resulting blast apparently destroyed the Valeyard. The Inquisitor dismissed the trial. (TV: The Ultimate Foe)

The Eighth Doctor – visiting his sixth incarnation to regain his lost memories after an attack by the Master – instigated a Commission of Inquiry into his past self's trial that resulted in the dismissal of the renegade High Council responsible. (PROSE: The Eight Doctors)

However, as the Sixth Doctor and his companion Melanie Bush departed, the Valeyard was secretly still present – having somehow escaped under the guise of the Keeper of the Matrix. (TV: The Ultimate Foe)

Return
The Valeyard returned and tangled with the Doctor in his seventh incarnation, revealing his mastery of the Dark Matrix, a counterpart of the original. He assumed the identity of Jack the Ripper and used the Ripper murders to 'feed' the Matrix. He tried to use its power to give himself a true body, unconcerned with the dangers his actions posed to history. While he committed the Ripper murders, he used the Dark Matrix to reach into his past to corrupt the Doctor's other selves to do his work. He provoked the Doctor to destroy the other Time Lords as he left Gallifrey in his first incarnation, his fourth incarnation into destroying the Daleks at their beginning, and his fifth incarnation into drinking the bat's milk himself while Peri died in his place.

The Doctor escaped the Valeyard's influence by sealing his conscious mind in the TARDIS' telepathic circuits while investigating the new history created by the Valeyard's actions. He arrived in the alternate 1963 that would result from the Valeyard's presence in London and tried to leave his companion Ace with his first incarnation for safety. He learned the full details of the new timeline from that world's versions of Ian Chesterton and Barbara Wright. He reunited with the circuits in time to save Ace from being the Ripper's sixth victim.

The Doctor provoked the Matrix into rebellion against the Valeyard's control. He fought the Valeyard, who now called himself the Ripper, atop the church where the Valeyard had hidden his TARDIS. The destruction of that TARDIS and the Dark Matrix release of energy killed the Valeyard. (PROSE: Matrix)

False Valeyards
The Sixth Doctor found himself in an alternate version of London created by Ashley Chapel's use of the Millennium Codex. He manifested magical powers suitable to the new, unstable universe's laws of physics. Using these powers began to transform him into a variant of the Valeyard. The Doctor's fears of becoming the Valeyard allowed his potential in the Doctor to combine with the Kingdom’s unique physical properties and the Doctor’s ability to regenerate. This temporarily made him the Valeyard. The Doctor's true self was able to manifest with the aid of the TARDIS. (PROSE: Millennial Rites)

Years later, Es'Cartrss of the Tactire assumed the form of the meta-crisis Doctor to steal the the Tenth Doctor's memories. Before revealing his true identity, Es'Cartrss suggested to the Doctor that he was in fact the Valeyard. The Doctor dismissed this suggestion, leading to the revelation of Es'Cartrss identity. (COMIC: The Forgotten)

Personality
The Valeyard was similar to several of the Doctor's incarnations, cunning and verbal, with a knack for manipulation. He had a bit of a temper, and was prone to outbursts, but generally calm and collected, traits of several incarnations of the Doctor. However, his actions were constantly defined by his egotism. The Valeyard would risk or sacrifice anything to ensure his own existence, even break the Laws of Time and kill his own past self and try to control the Dark Matrix despite the dangers its presence would pose to established history. (TV: The Mysterious Planet, The Ultimate Foe, PROSE: Matrix)

Behind the scenes

 * Some of the background for the Valeyard was lost due to creative differences between John Nathan-Turner, Doctor Who's producer, and script editor Eric Saward. An earlier draft of The Ultimate Foe made it clear that the Doctor would definitely, at some stage, turn into the Valeyard, desperate to extend his life after his remaining regenerations had run out – a situation not dissimilar to the one earlier faced by the Master. Nathan-Turner did not favour the dark nature of these and other developments in the script. Saward, who with Robert Holmes wrote the original script for The Ultimate Foe, refused to allow any elements of it into the final product. Pip and Jane Baker ended up patching up the continuity – without reference to the scripts, for legal reasons.
 * With the events of Journey's End, some fans speculated that the meta-crisis Doctor would eventually become the Valeyard. The events of COMIC: The Forgotten lent credence to this. All of this credibility was lost, however, when this entity was revealed to be a Cranial Parasite attached to the Doctor. (COMIC: The Forgotten)
 * Writer's guidelines for the Virgin New Adventures specifically asked writers not to discuss the continuity issues created by the Valeyard or the Doctor's trial in The Trial of a Time Lord ("Anything featuring the Valeyard is out — he's a continuity nightmare, and a rather dull villain") and took the official line that those events had taken place in the Doctor's personal future. Some novels, however (Love and War by Paul Cornell, among others), did not do so.
 * The Valeyard appeared in the unauthorised fan novel charity publication Time's Champion begun by Craig Hinton and completed by Chris McKeon.
 * The character of the Dream Lord shared aspects of the Valeyard, as he also was created from the dark side of the Doctor, in a dream induced by Psychic Pollen. (TV: Amy's Choice).
 * Contrary to popular belief, 'Valeyard' is not a genuine legal title meaning doctor of law. The word was entirely made-up by writer Robert Holmes.