A Crown Prosecution Service solicitor accused of stalking his ex-wife "called her a prostitute" and told friends she had bipolar disorder, a court heard.
Scott Ainge, 47, is accused of harassing deputy district judge Kate Ainge, 41, after she told him she had cheated on him in September 2016.
Ms Ainge told Liverpool Crown Court she felt intimidated and frightened when Mr Ainge visited her parents' home.
Mr Ainge from Leyland, Lancashire, denies stalking between 2016 and 2018.
He also denies five counts of unauthorised access to information under the Computer Misuse Act .
The CPS solicitor is accused of accessing its computer system to get information about his estranged wife's new partner, Andrew Thompson.
Ms Ainge, who gave evidence from behind a screen, said her ex-husband would turn up every day in the first few weeks after she left the family home.
She said: "He used to come up behind and call me a 'prostitute' and a 'dirty little slut' and he'd whisper it in my ear."
Asked how it made her feel, she said: "Intimidated, frightened, upset."
The court heard that in October 2016 Ms Ainge had been with Mr Thompson at the Railway pub in Leyland when Mr Ainge arrived.
He started telling people she had bipolar disorder and was having an affair and "just humiliating me generally", she said.
He approached Mr Thompson and the pair "squared up" to each other, Ms Ainge said, adding that he then followed her back to a friend's house and told him she was a suicide risk.
The court heard Mr Ainge had told his estranged wife he was having her followed and showed her photos of her car.
Ms Ainge said that made her feel "very vulnerable, massively vulnerable."
The couple had met in 2003 and married in 2006, the court heard.
Ms Ainge said the marriage had deteriorated before she met Mr Thompson in May 2016 as they had "no common interests or values".
She said Mr Ainge had became very involved in the church, adding: "Scott believed he was put on earth as a Christian to be punished so we could go on to live a better life. I didn't share that."
Ms Ainge said after they had split up she found out that Mr Ainge had fathered a child with a friend's wife.
The trial continues.