Peter Madsen was once a kind of celebrity in Denmark and many seemed fascinated by the self-taught engineer who talked with enthusiasm about ocean exploration and space travel.
The "inventrepreneur", as he described himself, was no stranger to being the focus of attention, with his life frequently featured in television and magazine reports. This media coverage helped build the image of a man who said his work was to "challenge the ordinary".
His own crowd-funded submarine, the UC3 Nautilus - claimed by him to be the world's biggest privately-built submarine - catapulted Madsen to fame, and its 2008 launch in Copenhagen was the subject of much fanfare.
That submarine is now a crime scene, and the once-feted Madsen is now in disgrace, convicted of murder and facing life in jail.
He was arrested last August, in connection with the gruesome killing of Kim Wall, a respected 30-year-old freelance journalist whose body was found dismembered after she boarded the Nautilus to interview him.
From submarines to rockets
Born in 1971, Peter Madsen was six years old when his parents divorced. He went to live with his father - a man more than 30 years older than his mother who he described as authoritarian and violent.
It was his father, however, that shared with him a fascination for wars and rockets. Madsen would devote his next decades to these interests.
He started studying engineering but reportedly abandoned the subject after he thought he had learned enough to build submarines and rockets.
Friends described him to journalists as an eccentric person, who did not enjoy being contradicted and was uncompromising.
His brother said he was "his own greatest enemy" while his wife, who reportedly divorced him earlier this year, has not talked to the media.
Journalist Thomas Djursing, who in 2014 wrote a biography about Mr Madsen, told the Jyllands-Posten newspaper: "He is angry with God and everyone... He has a hard time getting along with other people - he has lofty ambitions and wants to do everything his way."
While building a submarine might seem challenging enough, after completing the 17m-long (56ft) Nautilus he moved on to a more lofty ambition: space exploration.
He partnered with the architect Kristian von Bengtson, a former Nasa contractor, to form Copenhagen Suborbitals, a collective of amateur rocket-makers funded by donations and working with the aim of launching a manned rocket into space.
But their co-operation fell apart in 2014 due to disagreements, blamed largely on Peter Madsen's behaviour. He went on to create Rocket Madsens Space Laboratory, competing with his former partners.
"My passion is finding ways to travel to worlds beyond the well-known," he wrote on the organisation's website.
In 2015, after another dispute, this time with the group of volunteers maintaining the Nautilus, Peter Madsen said: "You may think that a curse is lying on the Nautilus. That curse is me," according to a statement on the website (in Danish).
He added: "There will not be peace on Nautilus for as long as I exist."
The last voyage
After months spent chasing Peter Madsen, Kim Wall took up his invitation for a trip on the Nautilus on 10 August 2017. She was never seen again, and her mutilated torso was discovered on a beach by a passing cyclist on 21 August.
Her head, legs and clothing were found by police divers on 6 October in bags weighed down with pieces of metal.
Peter Madsen was rescued the morning after the trip as his vessel was sinking, and has, since then, given three versions of what happened.
He initially told police that he had dropped off the reporter before the vessel began to go down.
Then he said the submarine's 70kg (150lb) hatch fell on Ms Wall's head after a "terrible accident" on board, and that he dumped her body somewhere in Koge Bay, about 50km (30 miles) south of Copenhagen.
Finally, he told police that the journalist had been killed by carbon monoxide poisoning inside the submarine while he was up on deck.
He had initially denied cutting up her body but then admitted dismembering it and dumping the body parts in the sea. But he denied killing her.
Madsen now faces a life sentence in jail, seen as unusual under the Danish criminal justice system.
During the opening session of his trial last month, prosecutors said there was a suspicion that he had "psychopathic tendencies". Films found on his computer showed women being tortured and mutilated, they added, trying to make the case that the murder was premeditated.
His defence, however, argued that there is no physical evidence against him.