Thanks to Moriarty, I found the book I was looking for. It is called The Neutronium Alchemist and is the second book in the Night's Dawn Trilogy.
Link to Wikipedia
The Neutronium Alchemist is a science fiction novel by Peter F. Hamilton and is the second book in The Night's Dawn Trilogy. It follows on from The Reality Dysfunction and precedes The Naked God.
Here are some snippets from the plot summary, which contain a few things mentioned in the question:
[...]
On Avon the Confederation Assembly is stunned to learn of the threat from the possessed. [...] The Kiint ambassador reveals that, many thousands of years ago, they also suffered a 'possession crisis', as the secret of death is one that is eventually discovered by all sentient races. They claim that their solution to the crisis is not applicable to humanity, who must find their own way.
Alkad Mzu departs from the blackhawk Udat, leaving behind a virus in
its jump system which causes the destruction of Udat whilst making a
wormhole transit. She does this both to protect knowledge of her
whereabouts and also as revenge: Udat was one of the blackhawks which
crippled the Beezling just before the Garissan Genocide.
[...] On New California a few possessed manage to get loose on the
planet, but they are disorganised and unable to make much headway. One
of the possessed appears to be a raving lunatic, but as the days pass
the possessing soul's presence in a normally-functioning brain restore
his sanity and his memory. The possessing soul turns out to be Al
Capone, a famed gangster from 20th century Chicago. Capone organises
the possessed and they take over the planet in a matter of weeks.
Capone realises they need to keep the planet's economy and
starship-building capability going to defend themselves from any
counter-attack, so many citizens are spared from possession (the act
of which interferes with electrical systems nearby) as long as they
contribute to the expansion of Capone's 'Organisation'.[...]
This is from the "The Reality Disfunction" wikipage:
[...] but not before one of the possessed reveals a terrible
secret: the possessing entities are the souls of humans who have died
and been trapped, some of them for millennia, in an absolute void
where the only way to pass the time is to parasitically feed on the
memories and experiences of others. And there are billions of them in
the darkness still screaming for escape.
I remember how the possessed feared to go back into that void. They are able to withstand all kind of torture when people try to force them to go back. The only way to free someone is to put them into stasis and wait for the possessed to leave, iirc.