The judges, a man and woman known in court as I and J, both employed Roselane Driza, but later sacked her, the Old Bailey heard.
Judge I had a relationship with her and Ms Driza later stole videos of him having sex, it is alleged.
Ms Driza, 37, from South Norwood, south London, denies blackmail and theft.
Judge I sent two passionate emails to Ms Driza during their affair, describing her as “real chilli hot stuff”.
He wrote: “You are real chilli hot stuff. I love you very much.”
J had advertised for a cleaner and interviewed Ms Driza, who told her she was a student who was granted refugee status, the court heard. But in fact she was an “overstayer” working illegally, a fact she would later use to blackmail J, said David Markham, prosecuting.
J introduced Ms Driza to I, a colleague at Britain’s Asylum and Immigration Tribunal and former lover, with whom she had remained good friends.
When J sacked Ms Driza in the summer of 2004, I decided it would be “prudent” to end her employment with him as well, the court heard.
But I told the Old Bailey yesterday he had started a relationship with Ms Driza after she stopped being his cleaner.
He did not tell J that Ms Driza had moved in with him and when she found out she was “appalled” — leading him to end the relationship with Ms Driza to save his friendship.
The prosecution claim Ms Driza threatened to expose J to her boss for employing her without a work permit, unless she was paid £20,000 (€29,700). She told I she would make a similar complaint against him, and also took two videos of him having sex with other women and threatened to send them to his superiors, the court heard.
Asked by Frances Oldham QC, defending, why he was still sleeping with her in 2005, I said it was because he did not want her to pursue her threats.
Ms Oldham said: “You were using her as a cheap housekeeper with whom you were able to enjoy sex.”
The trial continues.