Two years after the Arab uprisings fuelled a wave of protests and occupations across the world, mass demonstrations have returned to their crucible in Egypt. Just as millions braved brutal repression in 2011 to topple the western-backed dictator Hosni Mubarak, millions have now taken to the streets of Egyptian cities to demand the ousting of the country's first freely elected president, Mohamed Morsi.

As in 2011, the opposition is a middle-class-dominated alliance of left and right. But this time the Islamists are on the other side while supporters of the Mubarak regime are in the thick of it. The police, who beat and killed protesters two years ago, this week stood aside as demonstrators torched Morsi's Muslim Brotherhood offices. And the army, which backed the dictatorship until the last moment before forming a junta in 2011, has now thrown its weight behind the opposition.

Whether its ultimatum to the president turns into a full-blown coup or a managed change of government, the army – lavishly funded and trained by the US government and in control of extensive commercial interests – is back in the saddle. And many self-proclaimed revolutionaries who previously denounced Morsi for kowtowing to the military are now cheering it on. On past experience, they'll come to regret it.

The protesters have no shortage of grievances against Morsi's year-old government, of course: from the dire state of the economy, constitutional Islamisation and institutional power grabs to its failure to break with Mubarak's neoliberal policies and appeasement of US and Israeli power.

But the reality is, however incompetent Morsi's administration, many key levers of power – from the judiciary and police to the military and media – are effectively still in the hands of the old regime elites. They openly regard the Muslim Brotherhood as illegitimate interlopers, whose leaders should be returned to prison as soon as possible.

Yet these are the people now in alliance with opposition forces who genuinely want to see Egypt's revolution brought at least to a democratic conclusion. If Morsi and the Muslim Brotherhood are forced from office, it's hard to see such people breaking with neoliberal orthodoxy or asserting national independence, as most Egyptians want. Instead, the likelihood is that the Islamists, also with mass support, will resist being denied their democratic mandate, plunging Egypt into deeper conflict.

Egypt's latest eruption has immediately followed mass protests in Turkey and Brazil (as well as smaller upheavals in Bulgaria and Indonesia). None has mirrored the all-out struggle for power in Egypt, even if some demonstrators in Turkey called for the prime minister, Recep Tayyip Erdoğan, to go. But there are significant echoes that highlight both the power and weakness of such flash demonstrations of popular anger.

In the case of Turkey, what began as a protest against the redevelopment of Istanbul's Gezi Park mushroomed into mass demonstrations against Erdoğan, 's increasingly assertive Islamist administration, bringing together Turkish and Kurdish nationalists, liberals and leftists, socialists and free-marketeers. The breadth was a strength, but the disparate nature of the protesters' demands is likely to weaken its political impact.

In Brazil, mass demonstrations against bus and train fare increases turned into wider protests about poor public services and the exorbitant cost of next year's World Cup. As in Turkey and Egypt, middle-class and politically footloose youth were at the forefront, and political parties were discouraged from taking part, while rightwing groups and media tried to steer the agenda from inequality to tax cuts and corruption.

Brazil's centre-left government has lifted millions out of poverty, and the protests have been driven by rising expectations. But unlike elsewhere in Latin America, the Lula government never broke with neoliberal orthodoxy or attacked the interests of the rich elite. His successor, Dilma Rousseff – who responded to the protests by pledging huge investments in transport, health and education and a referendum on political reform – now has the chance to change that.

Despite their differences, all three movements have striking common features. They combine widely divergent political groups and contradictory demands, along with the depoliticised, and lack a coherent organisational base. That can be an advantage for single-issue campaigns, but can lead to short-lived shallowness if the aims are more ambitious – which has arguably been the fate of the Occupy movement.

All of them have, of course, been heavily influenced and shaped by social media and the spontaneous networks they foster. But there are plenty of historical precedents for such people power protests – and important lessons about why they are often derailed or lead to very different outcomes from those their protagonists hoped for.

The most obvious are the European revolutions of 1848, which were also led by middle-class reformers and offered the promise of a democratic spring, but had as good as collapsed within a year. The tumultuous Paris upheaval of May 1968 was followed by the electoral victory of the French right. Those who marched for democratic socialism in east Berlin in 1989 ended up with mass privatisation and unemployment. The western-sponsored colour revolutions of the last decade used protesters as a stage army for the transfer of power to favoured oligarchs and elites. The indignados movement against austerity in Spain was powerless to prevent the return of the right and a plunge into even deeper austerity.

In the era of neoliberalism, when the ruling elite has hollowed out democracy and ensured that whoever you vote for you get the same, politically inchoate protest movements are bound to flourish. They have crucial strengths: they can change moods, ditch policies and topple governments. But without socially rooted organisation and clear political agendas, they can flare and fizzle, or be vulnerable to hijacking or diversion by more entrenched and powerful forces.

That also goes for revolutions – and is what appears to be happening in Egypt. Many activists regard traditional political parties and movements as redundant in the internet age. But that's an argument for new forms of political and social organisation. Without it, the elites will keep control – however spectacular the protests.

• Twitter: @SeumasMilne

• The paperback edition of Seumas Milne's book The Revenge of History is available from the Guardian Bookshop