The Valeyard

The Valeyard was an entity created between the Doctor's "twelfth and final incarnations", perhaps the essence of the Doctor's dark side from that time.

First Meeting with The Doctor
Other than a cryptic hint as to the Valeyard's origins as the Doctor's future self (or part of his self), we do not know the origins of the Valeyard. According to the Master, the Valeyard is the personification of all that is 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 Doctor. He presented extracts from the Matrix depicting past events in the Doctor's life as evidence of the Doctor violating the non-interference policy of the Time Lords. (DW: The Mysterious Planet, DW: Mindwarp) Later in the trial he added a charge of genocide against the Vervoids. (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. The Valeyard was acting on behalf of the High Council to cover up the Ravolox affair. As payment, the Valeyard was to have received the Doctor's remaining regenerations. (DW: The Ultimate Foe) The Master stepped in and revealed the Valeyard's true origins.

The Valeyard escaped into the Matrix via the Seventh Door, which he opens using a copy of the Key of Rassilon. He is pursued and finally defeated by the Doctor when an explosion the Valeyard had intended to destroy the court is fed back into the Matrix due to the Doctor's tampering.

However, as Inquisitor Darkel dismissed the trial and the Doctor and his companion departed, the Valeyard was also present, disguised as 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. (PDA: Matrix)

Impersonation
Years later, a creature called the Es'Cartress of the Tactire assumed the form of the Meta-Crisis Tenth 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)

Other Timelines
In one timeline, the Valeyard defeated the Doctor and went on to wreak havoc throughout time and space. (DWU: He Jests at Scars...)

Behind the Scenes

 * Due to creative differences which occurred between the writing of the original version of The Ultimate Foe and its production between John Nathan-Turner, Doctor Who's Producer at the time, and his Script Editor Eric Saward (who, with Robert Holmes, wrote the script), some of the background behind the Valeyard got lost. With Saward refusing to allow any elements of the second episode (the fourteenth and final episode of Trial of a Time Lord as a whole), Pip and Jane Baker ended up patching up the continuity without (for legal reasons) reference to the scripts. 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 not dis-similar situation to the one faced by the Master.) The creative dispute had arisen from the dark nature of these and other developments in the script, with John Nathan-Turner not favouring such a downbeat approach.
 * With the events of Journey's End, some fans have begun to wonder as to whether or not the Meta-Crisis Tenth Doctor will eventually become the Valeyard. The events of The Forgotten has lent some credence to this. Some of this credibility is lost, however, when this entity is revealed to be a Cranial Parasite attached to the Doctor, right after the events on the Crucible.
 * Writer's guidelines for the Virgin New Adventures specifically asked writers not to discuss about 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, such as Love and War by Paul Cornell, among others, did, however.
 * The Valeyard appeared in the un-authorized fan novel charity publication Time's Champion begun by Craig Hinton and completed by Chris McKeon.