On the evening of 28 October, as they absorbed the election of far-right Brazilian president Jair Bolsonaro, British leftists declared “socialism or barbarism”. The slogan was assumed by some to be a Corbynite coinage. But it was first popularised more than a century ago in war-ravaged Europe.

In 1915, writing under the pseudonym Junius to evade prosecution, German Marxist leader Rosa Luxemburg warned: “Bourgeois society stands at the crossroads, either transition to socialism or regression into barbarism.”

To Luxemburg’s dismay, rather than uniting in opposition to the First World War, Europe’s left-wing parties rallied behind their national governments. “Workers of the world unite in peacetime – but in war slit one another’s throats,” she observed acidly.

Luxemburg and co-leader Karl Liebknecht responded in 1916 by founding the revolutionary Spartacist League (named after Spartacus, the leader of the largest Roman slave rebellion), a breakaway from Germany’s Social Democratic Party.

Stripped of their original context, Luxemburg’s words – “socialism or barbarism” – have been derided by liberals as a false dichotomy. Did Stalinism not prove that some hideous admixture of both could result? If so, Luxemburg can credibly claim to have foreseen the rise of barbarous socialism. Indeed, her life and work demonstrated rare moral clarity.

Rosa Luxemburg was born in 1871 to a Jewish family in Zamosc in Russian-occupied Poland. Having been politicised from her early years – a wave of anti-Jewish pogroms began in 1881 – she joined the Polish Proletariat Party at the age of 15. Faced with the permanent threat of arrest, the intellectually precocious Luxemburg emigrated to Switzerland, where she attended the University of Zurich and became one of the few women in the city to be awarded a doctorate.

Luxemburg considered herself a citizen of the world, a view she expressed with unsparing force. Writing from prison in 1917 to her Jewish friend, the socialist and feminist Mathilde Wurm, she declared: “What do you want with these special Jewish pains? I feel as close to the wretched victims of the rubber plantations in Putumayo and the blacks of Africa with whose bodies the Europeans play ball… I have no special corner in my heart for the ghetto: I am at home in the entire world.”

But it was to acquire German citizenship – and a place in Europe’s pre-eminent socialist party – that Luxemburg married Gustav Lubeck, the son of a friend, in 1897 (the couple never lived together and divorced five years later).

Though a foe of reformist socialism, Luxemburg’s most notable dispute was with Lenin. Following the October 1917 Russian Revolution, she upbraided the Bolsheviks for their disbandment of the elected Constituent Assembly and their suppression of rival parties. “Freedom only for the supporters of the government, only for the members of one party – however numerous they may be – is no freedom at all,” she insisted, asserting that “freedom is always and exclusively freedom for the one who thinks differently” (a slogan adopted by East German protesters in 1988). Here, there are echoes of John Stuart Mill, who wrote in On Liberty that unless received wisdom was “vigorously and earnestly contested, it will, by most of those who receive it, be held in the manner of a prejudice.”

Six years before Stalin’s malevolent ascent began, Luxemburg identified the conditions that would enable the “dictatorship of the proletariat” to become the dictatorship of one man. “Without general elections, without unrestricted freedom of press and assembly, without a free struggle of opinion, life dies out in every public institution… bureaucracy remains as the active element.”

Having been imprisoned by the German government in 1916 for seeking to organise an anti-war general strike, Luxemburg was released on 8 November 1918, the day before the Kaiser abdicated and a republic was established.

Though Liebknecht went further and proclaimed a “free socialist republic”, Luxemburg opposed demands for the Spartacists to emulate the Bolsheviks and seize power by force. Following the formation of the German Communist Party in January 1919, she advocated participation in the inaugural Weimar elections but the party congress endorsed a boycott. When a mass workers’ uprising began in response to the government’s dismissal of Emil Eichhorn, the left-wing Berlin police chief, Luxemburg foresaw catastrophe but felt obliged to participate.

The Social Democratic president Friedrich Ebert responded by ordering the proto-Nazi Freikorps to crush the rebellion. On 15 January, her skull having been cracked with a rifle butt, Luxemburg was shot dead and thrown into Berlin’s Landwehr Canal (where a cast-iron memorial bearing her name now rests). “In her assassination,” Isaac Deutscher, Trotsky’s biographer, hauntingly observed, “Hohenzollern Germany celebrated its last triumph and Nazi Germany its first.”

Barbarities far greater than those Luxemburg envisaged would follow. But her most enduring insight was not to grasp how quickly the centre can collapse. Rather, it was to assert fearlessly that socialism and democracy are nothing without each other.