Williams said he was shocked and disturbed to learn that Craig had been sending "inappropriate" messages, letters and poems to MacGregor.
The contents of some of the letters and a card were read in court this afternoon. In the first letter, handwritten, Craig gushes over how much he likes MacGregor, how "precious" he considers her and how he feels they are "kindred spirits".
Craig describes his relationship with MacGregor as "special".
"I do think that we work together amazingly well, not only are we effective but I think we are in tune with each other ... it is more than just working together, I have to say that I honestly enjoy spending time with you ... I assume you enjoy it too."
He goes on:
"Sometimes, especially when I am tired, it lifts my spirits just to spend time with you."
He revealed he had been asked by another staffer if he had kissed MacGregor.
"Obviously the answer to that question was no, not that I wouldn't want to, a lot, but that is a boundary.
"I have never even given you a hug, I actually regret that. There have probably been a couple of times I would have liked to - if it was okay with you. One to discuss."
Craig then recalled asking MacGregor not to wear low cut shirts to work. He "usually had "good control" but he had been "caught out" looking down the front of her top.
"My eyes went where they should not have gone," he wrote.
After viewing the letters Williams believed he had a "moral" duty to warn other members of the Conservative Party about Craig's actions. He met with several members soon after and disclosed what he knew.
When Craig found out, he held a press conference at which he inferred Williams, blogger Cameron Slater and former Conservative Party member John Stringer had lied about him, and that he would be taking legal action against them for defamation.
"Each of these culprits will be held to account for the lies they have told," he said.
At the same time, Craig released a leaflet titled Dirty Politics and Hidden Agendas, in which he named Williams and the other "culprits" spreading "false allegations" about him and went on to accuse them of running a campaign against him, a "strategy" to remove him as leader of the Conservative Party.
Williams vehemently denies any dishonesty, and filed his own civil case against Craig, saying the politician defamed him both at the press conference and in the pamphlet.
"I was not involved with any coordinated campaign," he told the jury.
He said he was driven to out Craig's behaviour simply - and only - because "it was the right thing to do".
He was "incensed by Mr Craig's hypocrisy" and said the former leader was "fundamentally flawed".
Mr Craig, in my opinion, was lying and he was putting Rachel, someone who I care about deeply, thorough hell.
"I believed I was standing up to a bully, someone who was lying to people."
He recalled watching the press conference in his office.
"I immediately felt my heart race ... I was certainly breathless from the moment Mr Craig mentioned my name."
Williams said he was immediately worried about the impact the allegation may have on his career and sought legal advice soon after.
"I was obviously alarmed," Williams said.
At the same press conference Craig said "I have never sent a sexually explicit message in my life".
The jury heard earlier today about at least one raunchy text Craig sent MacGregor before she resigned.
"I slept well last night because I dreamed I was between your naked legs," it allegedly read.
The defamation trial is in its second day in the High Court at Auckland.
This afternoon Williams spoke about the personal toll Craig's actions had taken on him and MacGregor.
He said that for her the worst point was when rumours started to circulate that she had been having a full blown affair with Craig and was his "mistress".
One of the things that stressed (MacGregor) out the most was people thinking that she was sleeping with Mr Craig - that was a nightmare situation for her.
"There was no sexual relationship," Williams said.
"Rachel was absolutely beside herself ... I was having difficulty too ... I had stomach aches, diarrhoea and I was getting very little sleep."
During his evidence today, Williams presented a number of media interviews and video clips to the jury in which Craig spoke about MacGregor's resignation, including two press conferences held by the politician.
Williams claimed that during these media appearances Craig had been misleading and inconsistent about his behaviour towards his former press secretary and had "fuelled" speculation around the situation while trying to "frame" MacGregor as a liar.
"Anything that made him look good or made Rachel look bad, Mr Craig was out there in the open," he said.
The trial continues, with MacGregor and Craig expected to give evidence later this week.