The Valeyard

The Valeyard was an entity which was created "somewhere between the Doctor's twelfth and final incarnations".

First meeting with the Doctor
Other than a cryptic hint, the origins of the Valeyard are unknown. According to the Master, the Valeyard was the personification of all that was evil within the Doctor, estimated to have been taken from somewhere between his twelfth and final incarnations. (DW: The Ultimate Foe)

The Valeyard served as the prosecutor in the trial of the Sixth Doctor. He presented extracts from the Matrix depicting past events in the Doctor's life as evidence of the Doctor violating the Time Lords' non-interference policy. (DW: The Mysterious Planet, DW: Mindwarp) Later in the trial, the Valeyard added a charge of genocide against the Vervoids even though they technically were not a living species. (DW: Terror of the Vervoids)

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. He added the charge of genocide of the Vervoids. The Valeyard acted on behalf of the High Council to cover up the Ravolox affair that the Doctor had accidently uncovered. As a reward, the Valeyard was to receive the Doctor's seven remaining regenerations. However, the Master eventually stepped in after taking delight in seeing the Doctor's plight and revealed the Valeyard's motives. (DW: The Ultimate Foe)

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. 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 (EDA: The Eight Doctors).

However, as the Sixth Doctor and his companion Melanie Bush departed, the Valeyard was secretly still present, having possessed the Keeper of the Matrix. (DW: 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 (referencing DW: Genesis of the Daleks), and his fifth incarnation into drinking the bat's milk himself while Peri died in his place (referencing DW: The Caves of Androzani) (PDA: Matrix).

The Doctor escaped the Valeyard's influence by sealing his conscious mind in the TARDIS's 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. (PDA: Matrix)

False Valeyards
The 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. (MA: Millennial Rites)

Years later, a creature called the Es'Cartress of the Tactire assumed the form of the meta-crisis Doctor to steal the the actual Doctor's memories. Before revealing his true identity, the Es'Cartess suggested to the Doctor that he was in fact the Valeyard. The Doctor dismissed this suggestion, leading to the revelation of the Es'Cartess's identity. (IDW: 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. (DW: The Mysterious Planet, The Ultimate Foe, PDA: 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 IDW: 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. [citation needed]
 * 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 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 un-authorised 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 Valeyard, as he also was created from the dark side of the Doctor, in a dream brought on by Psychic Pollen. (DW: Amy's Choice).