Thirty years ago, ordinary people challenged an armed dictatorship, and won.

On 31 August 1980, the strikers in the Lenin Shipyard at Gdansk forced the Communist authorities in Poland to sign an agreement. It promised them – among many other lesser things – a free and independent trade union, the liberation of political prisoners, plural and uncensored media and the right to strike.

Within days, other strike committees all over Poland were winning the same sort of terms from their Party bosses. Soon all the local agreements ran together into a single movement covering the whole nation, which recruited 9 million members by the end of the year. Its leader was a fast- talking, pious, slightly rascally electrician called Lech Walesa. The name of the movement was "the Independent Self-Managing Trade Union Solidarity".

Everyone who was in that shipyard during the strike came out changed: wiser and perhaps with more faith in humanity. This was an occupation strike, asking strikers to forsake their homes and families for the sake of the common cause. The yard gates, almost hidden behind well- wishers' flowers and pictures of the Pope, were locked, and the workers forbade themselves to come out until they had won.

Inside, thousands of men in grey denim overalls lay on the grass listening to the Tannoy, as it broadcast the interminable negotiations in the Health and Safety hall. Outside the gate, women and children waited through long, hot August days. Sometimes they threw bread, salami and apples over the fence to their husbands, fathers and sons. There was paper and duplicator ink for smudgy bulletins in the yard, but not much to eat. Vodka was banned. In one of Europe's most cigarette-addicted nations, they banned indoor smoking too.

The stakes were very high. The workers inside and the families outside thought about the ZOMO riot police, itching to batter them with clubs. The foreign journalists in the yard thought more about the Soviet armoured divisions that had moved up to the Polish frontier. If they invaded, we assumed that the Poles would fight and there would be what the regime's euphemism called "a national tragedy". But that was a possibility the strikers refused to discuss. It was an extra fear they did not need.

The strikes spread and the government, riven by panicky arguments, finally gave way. On 31 August, Lech Walesa – enjoying every moment of it – took a silly monster pen, a souvenir from the Pope's visit the year before, and signed the Gdansk Accord. Deputy Prime Minister Mieczyslaw Jagielski, equally clearly hating every moment, signed too.

That was not the end of the story. In the months that followed, the regime tried to block, delay or otherwise cheat on all the main points of the agreements, repeatedly driving Solidarity into confrontation. Sometimes Poland seemed close to civil war. The disastrous economy fell apart; people slept on the pavements to keep their places in food queues. Solidarity itself grew divided, some blaming Walesa for not using the ultimate weapon of an all-out general strike. Finally, in December 1981, General Jaruzelski carried out a military coup, dissolving Solidarity, arresting thousands of its leading members and imposing martial law. But that wasn't the end of the story either. Solidarity became an underground resistance movement.

The Communist regime, now discredited and despised by everyone, lay on top of Poland like a dying tyrannosaurus. In 1988, a fresh wave of strikes forced the regime to convene a Round Table to discuss radical reform with Solidarity and other opposition groups. A compromise arranged for a "free" election in June 1989, gerrymandered to ensure that the Communists and their allies kept a parliamentary majority.

But the voters found a loophole – the requirement that all candidates must gain the backing of 50 per cent of the votes cast – and the regime list was wiped out. Four months later, the first government in "Soviet Europe" led by non-Communists took power. In 1990, Lech Walesa was elected President of the free Republic of Poland.

That first year of Solidarity, which had begun in summer and ended on a freezing December night, was a carnival which became a sustaining myth. Yet many of the things that made it special have been forgotten. One was the part played by women in those first weeks. The Gdansk strike began because of the sacking of Anna Walentynowicz, a small, bespectacled crane driver who became one of its toughest leaders. The Gdansk Agreement grew into a social manifesto because of a nurse called Alina Pienkowska, who made the negotiators include a long list of reforms to the health services.

And the strike would have been no more than a strike without Henryka Krzywonos, a tram driver. A few days after the stoppage began, Lech Walesa announced that it was over: he was ready to settle with the yard management for a pay rise, reinstatement of sacked workers and a promise of no victimisation. Henryka, shop steward of the city transport staff, stood up and shouted him down. Fifty thousand workers in other enterprises were on strike, she said, and it would be sheer treachery if the Lenin Shipyard left them in the lurch and made its own deal. "If you abandon us, we'll be lost; buses can't face tanks."

There were roars of approval. Walesa changed his mind and raced round the yard countermanding his own orders: the strike would continue and take on demands from other workplaces along the Baltic coast. Because of Henryka, an industrial dispute broadened into a revolution.

Forgotten, too, is the simple fact that Solidarity was a trade union. It relied on a formidable "adviser" team of opposition intellectuals. It was theatrically Catholic, and the strikers knelt at daily Masses in the yard. Deep down, it was powered by old-fashioned revolutionary nationalism: the longing to restore a genuinely independent Poland. But Solidarity, the form this uprising took, was essentially a working-class rebellion.

It was a colossal syndical upsurge based on the industrial proletariat, but a proletariat for whom "socialism" had become a dirty word. It had nothing but contempt for the Communist authorities, but hoped at first to co-exist with them rather than overthrow them. The "political" triumphs in the Solidarity agreements – relaxation of censorship, the freeing of political prisoners – were almost secondary achievements for the strike committees. Freedom of speech and the media were the best way of ensuring that the bread-and-butter elements of the agreement – the independence of the new union, better wages, no sackings on political grounds, getting supplies into the shops – would not be undermined.

Poles today find it hard to remember that Solidarity stood for what used to be called "anarcho-syndicalism". In other words, an extreme form of socialist democracy in which workers took charge of their own enterprises, elected their managements and voted on production plans. That was what the "self-managing" in Solidarity's title meant. This usually went with wage-levelling, to ensure equality in the work-place.

This was the programme of "workers' self-management" that Solidarity committees set up throughout Poland. But only parts of the programme could be carried out. Employees were delighted to fire their useless Party managers, and to take part in long, turbulent meetings about working conditions. But transforming the Polish economy into a decentralised "workers' control" democracy was hopeless. There was no economy left to transform. Industry was running down for lack of spare parts and a huge foreign debt choked off imports, while ordinary Poles spent much of their day standing in line outside barren shops.

For patriotic Poles today, Solidarity's glory is that it gave a mortal wound to the whole Soviet empire. The revolutions of 1989, which brought down Communism and united Europe, "began at Gdansk". Others disagree. The late Tony Judt, in his great book Postwar, wrote that "Communism was about power, and power lay not in Warsaw but in Moscow. The developments in Poland were a stirring prologue to the narrative of Communism's collapse, but they remained a sideshow. The real story was elsewhere" (i.e. in the actions of Mikhail Gorbachev).

But that is only half-true. Polish Communism began to die in August 1980; sooner or later, the Poles would have rolled its corpse aside and – if only to save the nation from chaos – established something like a democratic state. Moscow and Poland's Communist neighbours would then have faced a choice between risking a European war over Poland and allowing the disruption of the whole Soviet imperium. Gorbachev's greatness is that he ensured that the disruption would take place without bloodshed.

But even if Solidarity blew open the gates to the future, it belonged in many ways to the past. It was the end of many things, rather than a beginning.

To start with, it was the last grand uprising of the producers – of the men and women whose labour made wealth, and who claimed a right to control in their own workplaces how that wealth was produced and shared. Ten years before, the late Jimmy Reid and the workers of Upper Clyde Shipbuilders had occupied their yard and taken charge of production. But almost nobody remembers "workers' control" today. The producer is ignored or far off in China, while the consumer is supposedly king.

And the Gdansk events belong to another vanished age: the era of vast industrial plants employing many thousands of workers. The Communist regimes had encouraged giant factories, assuming that they would breed a disciplined working class to carry forward the building of socialism. In the event, these places became fortresses of rebellion, able through their very size to pour armies of angry workers onto the streets and bring a government to its knees. But new technology and the transfer of production to Asia means that few such megafactories – once the bastions of trade union power – survive in Europe today. The organised working class, that human torrent in cloth caps or berets pouring in and out of the factory gates as the whistle blew, has almost passed into history.

What remains from that August spirit, in a Poland committed to neoliberal free markets and individualism, in which enormous wealth gaps separate rich and poor?

Solidarity went through several shape-changes after 1980. It became a resistance movement devoted more to national independence than to workers' rights. Then, after 1989, it became one unsuccessful right-wing political movement among several others. Today it is once more a trade union, with a mighty name but limited influence.

Under the surface, Polish hopes changed too. In the bleak years under martial law, young people lost interest in the workers' control vision. In western Europe, they thought they saw a better system which worked: capitalism under a liberal democracy.

The "Solidarity generation" looks back with mixed feelings. But regret is not among them. If Solidarity had not given millions of people the confidence that by sticking together they could change everything, Poland in 2010 would look more like Ukraine – a dismal mess of failed hopes and dirty power-politics. Instead, it is a stable European democracy whose citizens are often fed up and furious but never passive.

The children of those who fought and suffered 30 years ago have been brought up with the Solidarity "myth". It doesn't seem to have much to do with the world they live in. And yet they have inherited a protesting, contradicting instinct which goes back to that 1980 revelation of what people can do together.