The Valeyard

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

Biography
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. (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, Mindwarp) Later in the trial he added a charge of genocide against the Vervoids (DW: The Trial of A Time Lord). 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). It was The Master who 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 Flavia dismissed the trial and the Doctor and his companion departed, the Valeyard was also present, disguised as a guard. (DW: The Ultimate Foe).

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