This paper aims to explain the rise and fall of communism by exploring the interplay between economic incentives and social preferences transmitted by ideology. We introduce inequality-averse and inefficiency-averse agents and analyze their conflict through the interaction between leaders with economic power and followers with ideological determination. The socioeconomic dynamics of our model generate a pendulum-like switch from markets to a centrally-planned economy abolishing private ownership, and back to restoring market incentives. The grand experiment of communism is thus characterized to have led to the discovery of a trade-o¤ between equality and efficiency at the scale of alternative economic systems. While our focus is on the long-run transitions from capitalism to communism and back observed in the course of the 20-th century, the model also derives conditions under which each of the systems can remain stable.