The Danish inventor accused of killing Kim Wall admitted on Wednesday to stabbing the journalist, but said he did it after she died to prevent gases from being trapped so her body would sink when she was dumped in the ocean.

Inventor Peter Madsen, who vehemently denied killing Wall, told his bizarre explanation during the second day of his trial on Wednesday. Madsen, 47, claimed Wall died when the mess room of the submarine filled with toxic fumes, causing her to suffocate. He said he went into a psychosis and decided to dispose of Wall’s body, according to the Telegraph. Madsen refused to provide details about the dismemberment, saying it was “horrible.”

"It's something so horrible that I do not want to go into detail. I will just say, that it was horrible," he said, according to Sky News.

KIM WALL’S ALLEGED KILLER SHARES DETAILS OF JOURNALIST'S 'GRIM' DEATH AT MURDER TRIAL

Madsen admitted to stabbing Wall after prosecutors mentioned the multiple stab wounds found on the recovered body parts. The inventor said he used a sharpened screwdriver to stab the body, but insisted they were done to make sure the parts would sink.

"I put some punctures in the body parts because I didn’t want them to be inflated by gases,” Madsen said, according to the Telegraph. “There is nothing sexual in the fact that the stab holes were in her vagina. I understand why you might think there was, but there was nothing sexual in it for me.”

Madsen said he stabbed her after taking her clothes off, beheading her and placing the head in a plastic bag. Prosecutors also said they found two holes in the bags that were recovered from the waters off Copenhagen.

"I wanted to make sure there were no traces in Nautilus, so yes. I am in a condition where I want this accident to go away," Madsen said about disposing Wall’s clothes.

Prosecutors said Madsen had an animated film of a naked woman being decapitated by a man on his hard drive. Another naked women was impaled by spikes. When asked about the movie, Madsen replied: “Why, have you seen ‘Seven’?”

The inventor denied being inspired by the animated film.

Madsen, 47, is charged with murder, dismemberment and indecent handling of a corpse for the way he disposed of Wall's body. Prosecutor Jakob Buch-Jepsen had said a psychiatric report of Madsen concluded that he is an intelligent man "with psychopathic tendencies" who has "no empathy or feelings of guilt."

The case is expected to end on April 25.

KIM WALL'S GRUESOME DEATH DETAILED IN PETER MADSEN MURDER TRIAL: A TIMELINE

Madsen was a co-founder of Copenhagen Suborbitals, a private aerospace consortium to develop and construct manned spacecraft. In 2011, it launched a homemade 30-foot rocket five miles into the sky over the Baltic Sea, a step toward its unrealized goal of launching a person into space.

In an interview with Danish weekly Soendagsavisen in 2014, Madsen said he one day "hoped to have a criminal career," adding he didn't want to rob a bank because "no one must be hurt."

Since September, the "Kim Wall Memorial Fund Grant," an online crowdfunding campaign, has raised funds that will be given to a female reporter. The $5,000 grant will be awarded on March 23, which would have been Wall’s 31st birthday.

Fox News’ Travis Fedschun contributed to this report.