The Valeyard

The Valeyard was an entity 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 during 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 weren't technically a living species. (DW: Terror of the Vervoids)

The Valeyard had secretly tampered with the Matrix extracts to show the Doctor in the worst possible light and steer the trial to a guilty verdict, such as creating the impression that the Doctor had betrayed his companion Peri Brown to save himself, or adding the charge of genocide against the Vervoids despite their artificial nature. The Valeyard was acting on behalf of the High Council to cover up the Ravolox affair that the Doctor had accidently uncovered. As payment, the Valeyard was to have received 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 true motives. (DW: The Ultimate Foe)

The Valeyard escaped into the Matrix via the Seventh Door, which he opened using a copy of the Key of Rassilon. He was pursued and finally defeated by the Sixth Doctor when he attempted to use a particle disseminator to destroy the court at the Doctor's trial, the Doctor programming the disseminator to feed back into the Matrix, escaping just before the resulting blast apparently destroyed the Valeyard. The Inquisitor subsequently dismissed the trial, while 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 now his mastery of the Dark Matrix, a counterpart of the normal Matrix. During this time he assumed the identity of Jack the Ripper, using the Ripper murders to 'feed' the Matrix as he attempted to use its power to give himself a true body, unconcerned about the dangers that his actions posed to history. While he committed the Ripper murders, he also used the Dark Matrix's power to reach out into his past to corrupt the Doctor's other selves to do his work, such as provoking the First Doctor to kill other Time Lords while he was leaving Gallifrey, the Fourth Doctor into destroying the Daleks at their beginning (DW: Genesis of the Daleks), and the Fifth Doctor into drinking the bat's milk himself while allowing Peri to die in his place (DW: The Caves of Androzani). Fortunately, the Seventh 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- having arrived in the alternate 1963 that would result from the Valeyard's presence in London while attempting to leave his companion Ace with his first incarnation for safety, subsequently learning the full details of the new timeline from that world's versions of Ian Chesterton and Barbara Wright-, eventually being reunited with the circuits in time to save Ace from being the Ripper's sixth victim. Provoking the Matrix into rebelling against the Valeyard's control of it, the Doctor and the Valeyard- now calling himself the Ripper- clashed on top of the church where the Valeyard had hidden his TARDIS, until the destruction of the TARDIS and the Dark Matrix released a burst of energy that struck and killed the Ripper. (PDA: Matrix)

Other timelines
In one timeline, the Valeyard defeated the Doctor and went on to wreak havoc throughout time and space, twisting reality and changing his own history as he claimed control of the various doomsday weapons that the Doctor had 'foolishly' left behind or destroyed. When last seen, this Valeyard had sealed himself away inside his own TARDIS, imprisoning himself with various forcefields in order to keep himself immobilised, terrified to even move an inch in case he caused further damage to reality, reflecting that he had caused so much damage because he lacked the Doctor's knowledge of when to not take action. (DWU: He Jests at Scars...)

False Valeyards
When the Sixth Doctor found himself in an alternate version of London created by Ashley Chapel's use of the Millennium Codex, he began to manifest magical powers in keeping with the new unstable universe's laws of physics. However, using these powers began to transform him into the Valeyard. This was not the actual Valeyard, but a manifestation of the Doctor's worst fears of becoming the Valeyard allowed his dormant potential within The Doctor to combine with the Kingdom’s unique physical properties and The Doctor’s ability to regenerate. This temporarily reshaped him into the Valeyard, however the Doctor's true self was able to manifest with the aid of the TARDIS, despite the Valeyard's influence. (MA: Millennial Rites)

Years later, a creature called the Es'Cartress of the Tactire assumed the form of the meta-crisis Doctor, in order to steal the Doctor's memories. Prior to 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
In certain aspects, the Valeyard was similar to several of the Doctor's incarnations, quite 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, a trait numerous incarnations of the Doctor exhibited. However, his actions were constantly defined by his focus on himself, with the Valeyard willing to risk or sacrifice anything if it meant ensuring his own existence, as seen in his willingness to break the Laws of Time and kill his own past self and his attempt to control the Dark Matrix despite the dangers its presence would pose to established history. (DW: The Mysterious Planet, The Ultimate Foe, PDA: Matrix)

In an alternate timeline where he defeated the Doctor, he reflected that his most obvious difference from the Doctor was that he, unlike the Doctor, did not know when to stop, continually manipulating the universe to achieve his desired outcome where the Doctor was able to recognise that sometimes the best thing to do was to not take action. (DWU: He Jests at Scars...)

Behind the scenes

 * Some of the intended background behind the Valeyard was lost due to creative differences between John Nathan-Turner, Doctor Who's producer at the time, and script editor Eric Saward. An earlier draft of The Ultimate Foe had 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 previously faced by the Master. Nathan-Turner did not favour the dark nature of these and other developments in the script. As a result of the disagreement, 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 some 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-authorized fan novel charity publication Time's Champion begun by Craig Hinton and completed by Chris McKeon.
 * The character of the Dream Lord shared similarities with the 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).