Prosecutor
A Time Lord served as prosecutor during the Sixth Doctor's trial aboard Space Station Zenobia, holding the title of Valeyard, which the Sixth Doctor knew to mean "learned court prosecutor". (TV: The Mysterious Planet) The Valeyard was revealed by the Tremas Master to be an amalgamation of the Doctor's darker sides, taken from a point in the Doctor's personal future. (TV: The Ultimate Foe)
Behind the scenes
Contrary to the in-universe definition, "Valeyard" is not a genuine legal title meaning "learned court prosecutor." The word was entirely made-up by writer Robert Holmes. The title does bear some similarity to the French word "vieillard", meaning "old man", possibly alluding to the planned nature of the Valeyard as the Doctor's last incarnation.