The Danish inventor Peter Madsen has been sentenced to life in prison for killing the journalist Kim Wall.

Madsen invited Wall to board his homemade submarine in August. He was the last person to see her alive.

Gruesome details of Wall's death have emerged over the past few months.

An eccentric Danish inventor has been sentenced to life in prison for killing the Swedish journalist Kim Wall.

Peter Madsen, a 47-year-old entrepreneur and aerospace engineer, was the last person seen with Wall after he invited her on his homemade submarine last August.

The submarine sank, Madsen escaped, and Wall's dismembered body washed up days later on the shores of Denmark's capital, Copenhagen, the police said.

Wall was 30 and worked as a freelance journalist. The invitation aboard the UC3 Nautilus in Copenhagen was a response to Wall's request to meet him so she could write an article about him.

Several horrific details of the death have emerged over the past few months. Prosecutors have found evidence that:

A Copenhagen court on Wednesday convicted Madsen of murdering Wall, sexual assault without intercourse for the stabbing of Wall's genitals, and violating her corpse, tweeted Julie Thomsen, a reporter at the trial.

Madsen in May 2017. Scanpix Denmark/Ida Marie Odgaard/via REUTERS

Madsen previously denied murder and sexual assault, and he plans to appeal the verdict.

He changed his story multiple times after Wall's remains were found. He originally claimed the journalist was killed by a metal hatch slamming shut on her inside the submarine but later said she died of carbon monoxide poisoning.

In court, however, he acknowledged dismembering her body, saying he did so to lift it out of the vessel's hatch.

"What do you do when you have a big problem?" he said, according to Sky News. "You divide it into something smaller."