(this image appears for illustrative purposes only and no attempt is made to supersede any copyright attributed to it)
The Valeyard was, according to the Master, "an amalgamation of the darker side of the Doctor's nature", taken from somewhere between his "twelfth and final incarnations". He sought to take the Sixth Doctor's 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.
On behalf of the corrupt High Council, seeking to cover up the Ravolox 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. 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.
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. He also added the charge of Genocide of the Vervoids despite their artificial nature, and the fact this was from the Doctor's future.
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. 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.
Notes for The Valeyard
The Master in the Matrix
The Original Matrix
The truth about the Valeyard
Credit: BBC Worldwide