The short, unhappy life of Happy Sindane came to a sudden end in April, when he was stoned to death. The man charged with his killing is out on bail and the case continues. It has been 10 years since a teenager walked into a police station in a small town north of Johannesburg and told officers he had escaped from a black family who had kidnapped him as a baby, and put him to work as their slave.

Happy was the ultimate South African story in all its mad, sad, bitter comedy. My first novel, promptly banned by the old regime, was about a boy called Harry Moto who could not make up his mind what colour he was. But the real-life tragedy of Happy Sindane easily outdoes my imaginary tale. He was the embodiment of the question that haunts the country, but which was said to have gone away when freedom came: on which side of the racial divide do you stand – black or white? Happy had an answer. He was both, and it was a bad place to be. He lived on into the "new" South Africa where the obsessions with race and colour were more pronounced than ever. He responded by rewriting his life, trying to turn it into a fairytale that, but for one lucky moment, did not end as he'd hoped. The ugly duckling never made it to swan; Cinderella kept being hijacked on her way to the ball.

Happy was probably not his real name. But then nothing about Happy Sindane seems "real" – except his suffering, his humour and his hopes. He was born in 1984, so the best guess has it, in a suburb called Fourways, on the northern edge of Johannesburg. When he was about six, the small boy went for a walk with his mother and they met a woman called Betty Sindane. Happy's mother asked her to mind the child for a few minutes, then she disappeared into a liquor store and was never seen again.

When Betty Sindane reported what had happened to the police, she was asked to look after the boy until things were sorted out. But that never happened and Betty, with remarkable generosity for which she was neither thanked nor paid, took over as the boy's mother. They must have been very close because when Betty died 10 years later, Happy's life went downhill and the boy would go to her grave and weep. He was placed in the care of his "grandfather", Koos Sindane, who did what he could for the boy although the two did not get on. Happy was lonely and teased at school by his township classmates who saw him as a "white" boy in a black world. He had lost his mother twice and it was natural to invest everything now in his missing father, whom he built into a hero: rich, powerful and white. The trigger for what he did next seems to have been a TV programme he saw about babies who had been stolen from their prams. Suddenly Happy knew what to do. He would find his father, regain the world he had lost, and live happily ever after.

"Happy longed to know who he was and he wanted to meet his father. He believed he was rich and wanted his support." That was the view of Father Kuppelwieser, who was to befriend Happy, and who gave him a home in the Sizanani trust village, a refuge for severely disabled boys and girls he founded. In 2003, Happy, then about 16, strode into the police station of a nearby town called Bronkhorstspruit. He told officers he was a white boy, stolen when he was a child by the family domestic, and raised in a little village called Tweefontein, a couple of hours north of Johannesburg. He said he had been half-starved and made to live rough, and appealed for his true parents to come forward and take him home.

Happy Sindane pictured with an aunt. Photograph: Themba Maseko/Daily Sun/Camera Press

It is never easy to explain the intense and ruinous fascination with skin colour in South Africa. It is there in the manner that the country responded to the story of the stolen white child. Ten years into what must be very loosely called the "new" South Africa, when colour was said no longer to matter, the truth was it counted more than ever. South Africa had its very own Mowgli. There was talk of Hollywood movie contracts. White couples whose babies had gone missing came forward to claim this "slave boy" as their son. My guess is that by now even Happy believed his own story; and so did sponsors and well-wishers. He began appearing on TV in new clothes and expensive sunglasses. The pauper had turned into the prince.

There is a revisionist line being debated in the Afrikaans press now. Some historians argue that the Afrikaner nationalists who designed and drove racial policy for half a century were rather like those whites in the southern states of the US who wanted separate schools for whites, forbade mixed marriages and ordered black people to ride in the back of the bus. But there was no resemblance between their racial policies and those of the Nazis.

Anyone who lived in the heyday of apartheid will know this is nonsense. Those who wrote the rules of racial theory were obsessed with the purity of race, blood and tribe. They thought of little else: race infected everything from hair texture to heart transplants; it reached into love affairs and there was no escape from it. The country became a giant menagerie where divinely appointed zookeepers presided over less-than-human others, who were to be locked in the prisons of their skin.

Everyone knew this. Happy knew this when he walked into the police station and told his story. So did the cops who heard him, the kindly magistrate who sent off for DNA tests, as well as the priest who befriended the boy, and the white couples who came forward to claim him as their missing son.

When DNA tests showed Happy was – perhaps – the son of a shadowy German immigrant with the unlikely name of Henry Nick and his black housekeeper, Rina Mzayiya, and that his "real" name was Abbey Mzayiya, the excitement died away. What Happy had been doing had a name, back in the bad old days. He was "trying for white", and in 2003 no one wanted to remember the bad old days. People now felt rather let down; Happy was not the son of a rich white family, stolen by the maid. He was the son of the maid. Far from being a slave-child raised in the wild, he was a boy of mixed race, like millions of others. That was when the interviews and movie deals went out the window.

The grand gravestone is unveiled at Happy's funeral in Tweefontein. Photograph: Theana Breugem/Foto24/Camera Press

But Happy still had his uses. A big national paint manufacturer remembered him fondly and ran an advertisement showing his face alongside swatches of colour ranging from light to dark shades of skin, with the tagline: "Any Colour You Can Think Of." Almost a decade after South Africa rejected racial classification, here was a joke everyone was expected to find wonderfully apt.

Happy did not see the funny side and sued the paint company for using his picture without permission and was awarded several thousand pounds in damages. The paint company also offered to paint any children's home of Happy's choice, any colour he could think of. The jokes never end, do they?

The money went into a trust, and one of the first things Happy did was to erect a decent tombstone to his stepmother, Betty Sindane. But his adoptive family wanted a share of the money. Soon there was no cash left and Happy, in the children's refuge, was resistant to attempts to help or train or comfort him. Now perhaps 18, he was drinking a lot and when he hit rock bottom, inclined to lie down in the road and dice with death. "I only drink when I try to forget my past," he told a local newspaper. "It haunts me no matter how much I try to forget."

One day this suicidal game turned bloody when he was hit and run over by a mini-bus taxi and the vehicle behind. He was put on life-support in hospital, and pulled through.

After a succession of jobs around the Reef, Happy found himself again in Tweefontein, the place he had tried so hard to flee, living with his adopted family. When I talked to some of the drinkers in the JZ tavern where Happy liked to hang out, they said he was known for two things: getting drunk and being famous. One morning in April this year, after one of those drinking sessions at JZ, his body was found in a ditch down the road from the tavern. Happy had been beaten to death, and a fellow drinker from the tavern was charged with his murder.

Happy's funeral was a notable affair; he was back in the news once again and what you thought about him depended on which story of his life you leaned towards believing. I rather think he would have liked the fuss people made of his funeral. There was no money but all sorts of people chipped in. There was some tension between the family who had known him as "Abbey" and the Sindane family who had taken him in, and they clashed over who had the right to bury him. His age was given as 28, or 29, or 30. A local funeral company covered the costs of his burial and another donated a grand memorial gravestone worth thousands. In fact, if you add the price of the gravestone, announced by the donor in a PR release, to the burial costs, it comes to much the same sum Happy was awarded by the paint company that found him such a funny fellow.

Even his gravestone hedges its bets about the man who lies in Tweefontein cemetery. His names are given as "Abbey" and "Happy" and the portrait incised in the memorial stone is not a close likeness; but that is right for a man who never knew who he was and who never looked the way he did after the two taxis rode over him. But he never lost his capacity to amuse: in the most fearful way. After he died a cruel but exact joke went around: "What is better than being Happy? Being white."