Chinese history can be read as a series of peasant rebellions. One in the 19th Century, led by a man who thought he was Christ's brother, lasted 15 years and caused at least 10 million deaths. It taught the Communists lessons a century later, and is one reason why China's leaders keep a close eye on rural unrest today.

The founding congress of the Chinese Communist Party, at a Shanghai girls' boarding school in 1921, is commemorated in wax - waxwork figures around a dining table, some seated, some standing.

Mao himself is speaking, his eyes gazing off into the distance in a kind of visionary way. Some are drinking tea, some are smoking, some have fans in their hands.

At the time, they can hardly have imagined that they were men of destiny. They had to present themselves as a student group on vacation - and run away when the police came.

But these rebels ended up running China, they do not need to dwell on the miraculous good luck which brought them to power in 1949.

As History is My Witness Former BBC Beijing correspondent Carrie Gracie presents a 10-part series on figures from Chinese history who reveal something about China today

Programmes can be heard every weekday on BBC Radio 4 at 13:45 BST

Alternatively, listen again on the BBC iPlayer China: As History Is My Witness Download the podcast

The truth is that for every Chinese rebellion which succeeds, there are scores which fail - like the Taiping rebellion, led by a man influenced by Christian missionaries, who declared a heavenly kingdom on the Yangtze.

Originally, all Hong Xiuquan wanted was to be part of the establishment. A village schoolteacher, he immersed himself in Confucian scholarship for the civil service exam, but he just kept failing.

"He fell into what I suppose was some kind of depressive fit and he had a vision," says Jonathan Fenby, who has written a history of modern China.

"He imagined he'd gone up to the skies and there he had met a very tall man with a long beard and thick belt who had told him to come back to Earth and eradicate the demons on Earth."

Some time later he was given a Chinese translation of the New Testament by a Christian missionary.

"He decided on reading that, that the man he had seen up in the sky was the Christian God, that he, Hong, was the brother of Jesus, and that the devils he had to exterminate on Earth were the Qing dynasty, which was then ruling China and of course was not Chinese."

There was plenty of whipping and Confucius asked for mercy repeatedly Hong's vision

The Qing emperors were Manchus from Manchuria in the north-east, so they were not ethnically Han Chinese.

They had conquered China in the 17th Century, but their glory days were over and by the mid-19th Century they were losing to the British in the Opium Wars.

The Europeans brought Christianity which, for Hong, was a convenient alternative to the Confucian creed which had rejected him.

"Seeing that everyone in high heavens scolded him, Confucius escaped down to earth with the leader of the demons," goes an account of Hong's vision, set down in writing by a follower.

"The heavenly father then sent the angels to chase after Confucius, tie him up and bring him back to the heavenly father who was exceedingly angry and instructed the angels to whip him. There was plenty of whipping and Confucius asked for mercy repeatedly."

Image caption Famine and unemployment made peasants vulnerable to utopian thinkers

For the most part, China's emperors had not bothered much with religions. Buddhism had become very popular at a time of upheaval in the 6th Century, but it appealed mostly to people at the bottom of society.

Christianity was one of the novelties which had come in with the colonial powers. They used gunboats to open China to trade, and shattered the image of order and invincibility cultivated by the Qing emperors. Vernacular translations of the Bible helped loosen the grip of the Confucian elites.

The Europeans saw Hong's claim to be the brother of Christ as heresy, but he was not preaching for their benefit. He accompanied his spiritual message with a political one - a vision of equality and shared land ownership. This appealed to poor farmers, who were suffering from a sense of hopelessness, according to Guo Baogang of Dalton State college.

"Peasants have a very miserable life in the middle of the 19th Century," he says.

"There's a lot of famines and unemployment, most peasants have no land. So they're very vulnerable to the utopian thinkers prescribing a perfect society as a way to escape from the existing society."

Taiping rebellion Begins in 1850, ends in 1864

The Taiping Heavenly Kingdom takes Nanjing as its capital, and controls large parts of south China

After the failure to take Shanghai in 1861, it goes into decline

Rebels want to replace other religions with Christianity, and to keep sexes separate - even married couples

They seek to end private land ownership and private trade

The Qing government crushes the rebellion with the help of British and French forces

Hong and his disciples took to the road, selling writing brushes and ink and spreading the good news about the heavenly kingdom as they went. The movement grew fast in south-west China.

"When people of this earth keep nothing for their private use, but give all things to God for all to use in common, then every place shall have equal shares, and everyone be clothed and fed," Hong declared.

Jonathan Fenby describes the creed as "a strange mixture of Christianity and a primitive kind of communism". Land was to be shared, but the sexes had to be kept apart.

In many ways, he says, it was a message that was mirrored by another creed to arrive in China from outside a century later - Marxism. Mao took Marxism and bolted it on to this ancient yearning of China's farmers for land and justice.

Before Hong, similar rebellions brought an end to the Qin dynasty in the Third Century BC, the Mongol Yuan dynasty in the 14th Century, and nearly brought down the mighty Han dynasty, points out Beijing commentator Kaiser Kuo.

Peasants are "passive actors" throughout most of history, he says, but occasionally they rise up to keep the dynasty in line.

As in these earlier rebellions, many of those who joined Hong's Heavenly Army had nothing to lose. Population growth had deprived them of a stake in society. The Qing empire was a victim of its own success.

While Hong started lucky and got unlucky, Mao had it the other way round

"Once you have a long peace, you see the rapid growth of the population," says Guo Baogang.

"When the Manchus came into China, the population was about 100 million. By the 19th Century, after 200 years of economic growth, the population increased to something around 400 million. But arable land, that figure was only about 30% growth. So that added all the social stress."

The promise of land for all soon brought hundreds of thousands to Hong's banner.

They swept out of the south of China up to the Yangtze, and established their heavenly kingdom there in Nanjing, with Hong as the Heavenly King and the other commanders as the King of the West, the King of the East, and so on.

Their advance against one of the greatest empires in history was surprisingly easy, says Fenby. The Qing dynasty's famous troops, the Banner troops, which had conquered China in the mid 17th Century had gone downhill.

"By the mid-19th Century these Banner troops have become dissolute, opium-smoking, corrupt, very inefficient for the most part. And the Chinese mercenaries who fought for the Qing were even worse. So I won't say the Taiping had it easy but their opponents were in a pretty terrible state."

Hong showed peasant rebellion could work in the modern age. This was one of the lessons the Communists took from the Taipings. The two rebellions in fact had much in common, but - one key difference - while Hong started lucky and got unlucky, Mao had it the other way round.

By 1860, Hong's heavenly kingdom extended across huge swathes of China and his troops were preparing to march on Shanghai. But his luck was about to run out. The Europeans had decided he was a threat to business.

So they joined forces with the Qing armies they themselves had just been fighting. In the Heavenly Capital, the Heavenly Kingdom was anything but.

As military victory turned into defeat, Hong became increasingly paranoid, his followers starved and his court spiralled into intrigue and violence.

"Hong himself retreated to his palace with his 60 or so concubines listening to music played on an organ taken from the local Christian church and the generals all fought among one another," says Fenby.

By the end of the Taiping era at least 10 million had died, some say 20 million. Eyewitnesses described the Yangtze valley as littered with rotting corpses.

No-one knows exactly how Hong Xiuquan himself died. His decomposed body was discovered in his palace by a Qing general - an ignominious end for a challenger to empire and the opening of a terrible chapter in China's cycle of fragmentation.

"If you look at the history of China from say the Taiping through to the death of Mao in 1976, no country had as bad a prolonged period of disasters, regime change, civil war, invasion, decline," says Fenby.

Perhaps all of that is over. As the Communist Party prepares to hold its 18th congress, it would certainly like to think so. It has come a long way since the first congress in the Shanghai girls' school.

But behind the mask of order and unity, China still has plenty of conflict - over land rights, corruption or injustice. There are nearly 100,000 major riots every year. No wonder Party leaders see threats everywhere and scan the horizon ready to crack down on any sign of a peasant uprising like the one which brought them to power.