SWIFT told the jury how he had “hugged” Mr Williams as he lay dead after he had inflicted the fatal knife wounds.
Giving evidence Swift said he had initially acted in self defence, claiming Mr Williams had tried to stab him in the stomach with a knife.
Swift said Mr Williams became violent after he had confessed to him that he had been having an affair with Miss Carrigan.
He claimed Mr Williams came at him with a kitchen knife. He told the court: “When I got to the front door I remember the sensation that he was very close behind. I turned and he flung the knife into my stomach. I grabbed the blade and with the other hand I grabbed hold of his arm.
“I can remember letting go of the blade once I knew I had hold of his hand and that is when he dropped the blade.”
Swift then claimed he could not remember the details of how he attacked Mr Williams.
The court heard Swift has a history of suffering from depression and his mental health had suffered when a previous relationship with a woman had broken down in 2006.
Swift’s barrister, Bryan Cox, QC, asked his client: “Can you remember what you did after he was injured?”
Swift sobbed as he replied: “I did not want him to die. I picked him up and gave him a hug. But he was dead.”
The barrister also asked Swift: “What do you think caused you to inflict those injuries?
Swift replied: “I thought I was going to die.”
Mr Cox then asked: “Can you explain why you inflicted so many injuries.” Swift replied: “It was like a survival instinct.”
Swift claimed not to have any memory of wearing rubber gloves during the incident despite a pair being found on a footpath near to the house after the attack containing his DNA and Mr Williams’s blood..
Earlier in his evidence, Swift described how the constant on-off relationship with Miss Carrigan had a detrimental effect on his mental health.
He said: “It was too much. I knew that I could not keep going through the same thing over and over again.
“It was just going around in a continuous cycle. We had spoken about a new start in the New Year.
“She wanted a family and I wanted a family. She wanted a new start and said that she wanted to start that with me.”
Swift said Miss Carrigan had asked him for his mobile number soon after they first met in January 2015.
He said: “She explained that the relationship (with Mr Williams) was not working. I gave her my number and she contacted me and then we got chatting straight away.”
Mr Cox asked: “Did there come a time when your relationship became a sexual one.”
He replied: “It was sexual from the start.”
Swift added: “Throughout the time she was getting to know me she explained to me that she suffered from anxiety and I felt that I was able to help her with the anxiety.
“She always described me as her rock.”