Peter Gordon in New Spectator:
Marxism has had a long and troubled relationship with religion. In 1843 the young Karl Marx wrote in a critical essay on German philosophy that religion is “the opium of the people”, a phrase that would eventually harden into official atheism for the communist movement, though it poorly represented the true opinions of its founding theorist. After all, Marx also wrote that religion is “the sentiment of a heartless world” and “the soul of soul-less conditions”, as if to suggest that even the most fantastical beliefs bear within themselves a protest against worldly suffering and a promise to redeem us from conditions that might otherwise appear beyond all possible change. To call Marx a “secularist”, then, may be too simple. Marx saw religion as an illusion, but he was too much the dialectician to claim that it could be simply waved aside without granting that even illusions point darkly toward truth.
In the 20th century the story grew even more conflicted. While Soviet Marxism turned with a vengeance against religious believers and sought to dismantle religious institutions, some theorists in the West who saw in Marxism a resource for philosophical speculation felt that dialectics itself demanded a more nuanced understanding of religion, so that its energies could be harnessed for a task of redemption that was directed not to the heavens but to the Earth. Especially in Weimar Germany, Marxism and religion often came together into an explosive combination. Creative and heterodox thinkers such as Ernst Bloch fashioned speculative philosophies of history to show that the religious past contained untapped sources of messianic hope that kept alive the “spirit of utopia” for modern-day revolution. Anarchists such as Gustav Landauer, a leader of post-1918 socialist uprising who was murdered by the far-right in Bavaria, strayed from Marxism into an exotic syncretism of mystical and revolutionary thought.
More here.