To many, Gandhi was a man who transcended superficial differences, a man who would refuse to differentiate or discriminate between people of different religions or castes; a man who belonged to all of humanity. Gandhis supporters often laud his writings and other attempts at breaking down caste barriers prevalent in India. But if Gandhi was opposed to one type of caste system, he was supportive of another form of segregation.
In South Africa, Gandhi first came into regular contact with Blacks. Instead of accepting this as a natural byproduct of going to a predominantly Black country, he recoiled from this contact with the Kaffir (an offensive term for Black Africans). The contrast of Gandhis views towards Whites is like night and day. From early on in his South Africa stay, Gandhi came to have a dislike of the native Blacks, especially concerning the fact that Indians were being compared to them:
A general belief seems to prevail in the colony that the Indians are little better, if at all, than the savages or natives of Africa. Even the children are taught to believe in that manner, with the result that the Indian is being dragged down to the position of a raw Kaffir. 
In one of Gandhis first petitions written in South Africa, Gandhi complained about laws treating Indians akin to native Blacks:
If the whole objection to the Indian proceeds from sanitary grounds, the following restrictions are entirely unintelligible:
1. The Indians, like the Kaffirs, cannot become owners of fixed property.
2. The Indians must be registered, the fee being 3 pounds 10S.
3. In passing through the Republic, like the Natives, they must be able to produce passes unless they have the registration ticket.
4. They cannot travel first or second-class on the railways. They are huddled together in the same compartment with the Natives.
So far as the feeling has been expressed, it is to degrade the Indian to the position of the Kaffir.
At the turn of the century, during one of Gandhis trips to India, he complained about the position of Indians in South Africa, referring to Blacks with a cruelty and bitterness that he never used to describe committers of violent acts:
Ours is one continual struggle against a degradation sought to be inflicted upon us by the Europeans, who desire to degrade us to the level of a raw Kaffir whose occupation is hunting, and whose sole ambition is to collect a certain number of cattle to buy a wife with and, then, pass his life in indolence and nakedness.
Part of Gandhis attitude stemmed from his belief in the Aryan Invasion Theory, that of the superior White race from the Steppes subjugating darker races all across Eurasia. Gandhi snobbishly refused to accept classification with aboriginal looking savages:
. . . A reference to Hunters Indian Empire, chapters 3 and 4, would show at a glance who are aborigines and who are not. The matter is put so plainly that there can be no mistake about the distinction between the two. It will be seen at once from the book that the Indians in South Africa belong to the Indo-Germanic stock or, more properly speaking, the Aryan stock. 
Gandhi not only believed in the superiority of his stock, but also wanted to bring the so-called Aryan characteristicsnon-physical, of courseto the African Blacks. He believed that White rule in South Africawith the help of a reduction in Asiatic immigrationwas necessary for civilizing the Blacks with these characteristics:
We, therefore, have no hesitation in agreeing with the view that in the long run assisted Asiatic immigration into the Transvaal would be disastrous to the white settlement. People will gradually accommodate themselves to relying upon Asiatic labour, and any White immigration of the special class required in the Transvaal on a large scale will be practically impossible. It would be equally unfair to the Natives of the soil. It is all very well to say that they would not work, and that, if the Asiatics were introduced, that would be a stimulus to work; but human nature is the same everywhere, and once Asiatic labour is resorted to, there would not be a sustained effort to induce the Natives to work under what would otherwise be, after all, gentle compulsion. There would be then less talk about taxing the Natives and so forth. Natives themselves, used as they are to a very simple mode of life, will always be able to command enough wages to meet their wants; and the result will be putting back their progress for an indefinite length of time. We have used the words gentle compulsion in the best sense of the term; we mean compulsion of the same kind that a parent exercises over children. 
As the above 1903 Indian Opinion article he wrote implies, Gandhi was a firm believer in White settlement and rule in South Africa. More explicitly, he would write that the White race deserved to be the dominant race in historically Black South Africa:
What the British Indians pray for is very little. They ask for no political power. They admit the British race should be the dominant race in South Africa. All they ask for is freedom for those that are now settled and those that may be allowed to come in future to trade, to move about, and to hold landed property without any hindrance save the ordinary legal requirements. 
Along with the dominance of the White race in South Africa, Gandhi also held dear the idea of racial purity:
We believe as much in the purity of race as we think they do, only we believe that they would best serve these interests, which are as dear to us as to them, by advocating the purity of all races, and not one alone. We believe also that the white race of South Africa should be the predominating race.
Commenting on a petition opposing interactions between Whites and Coloureds, Gandhi wrote:
. . . The petition dwells upon the co-mingling of the Coloured and white races. May we inform the members of the conference that, so far as the British Indians are concerned, such a thing is practically unknown? If there is one thing, which the Indian cherishes more than any other, it is the purity of type. Why bring such a question into the controversy at all? 
Gandhis desire for Indians to be segregated from Blacks was so strong that he went to Johannesburg in late August of 1904 to protest the placing of Blacks in the Indian section of the city:
Why, of all places in Johannesburg, the Indian Location should be chosen for dumping down all the Kaffirs of the town passes my comprehension. . . . Of course, under my suggestion, The Town Council must withdraw the Kaffirs from the Location. About this mixing of Kaffirs with the Indians, I must confess I feel most strongly.
While it is understandable to be upset over a sudden movement of people into ones area, reading Gandhis article, it becomes clear that Gandhi was more upset that the Blacks would be living in close proximity with Indians. It is unlikely that he would have minded a sudden influx of Whites into the Indian location. For instance, during the same period of Black movement into the Indian location, Gandhi would argue vehemently that Indian interaction with Whites surely was not harming the Whites:
The last reason given by the Public Health Committee is the miserable plea of social intercourse between the poorer whites and the poorer Indians. In the first instance, there is absolutely no social intercourse between the two and, in the second, we would very much like to know in what way the presence of the Indian has contributed to the social deterioration of the white man; what is the particular vice of the Indian community which the white man has contracted during the last seventeen years. And the phenomenon of the two classes living side by side is by no means particular to Johannesburg . . . 
Gandhi also hated being forced to register as an uncivilized race, like Blacks were made to do:
It is one thing to register Natives who would not work, and whom it is very difficult to find out if they absent themselves, but it is another thing and most insulting to expect decent, hard-working, and respectable Indians, whose only fault is that they work too much, to have themselves registered . . . 
Perhaps the reason some of the Natives were not working was because they were planning and acting out a revolt against foreign rule. When rebellion broke out, Gandhi choose to side strongly with the British, hoping to prove to the British that the Indians were subservient. A true Kshatriya would have held out support unless offers were made for it. But Gandhi felt the need to once more prove his loyalty to the Empire, as he wrote in a letter to the secretary of Lord Elgin:
The chief reason for his having organized the Indian Ambulance Corps at the time of the Boer War and the Indian Stretcher Corps at the time of the Native Rebellion, was to bring about such [re]conciliation, by showing that British Indians were not unworthy to be citizens of the Empire and were capable of recognizing their obligations if they also insisted on their rights. 
Even the Black revolt against British rule could not shake Gandhis opinion of them being lazy and easy to manipulate. A couple years later, in 1908, Gandhi would complain that the Kaffirs were easy to please via little gifts, and that the British were doing the same to the Indians; again, the British were treating Indians like Kaffirs:
The whole affair is as much a disgrace to the Indian community as it is to the British Empire. The British rulers take us to be so lowly and ignorant that they assume that, like the Kaffirs who can be pleased with toys and pins, we can also be fobbed off with trinkets.
Previously, in 1906, Gandhi had started agitating for better rightsstill within the Empirefor Indians in South Africa. Of course, Indian secularists and Gandhi-lovers never present the dark side to his argument:
. . . His Excellency has, moreover, justified the definition of coloured person on the ground that it is a legacy from the old Government. But British Indians object to the definition for that very reason. Their position is this. The ordinances will not in practice apply to them. The Boer Government insulted the Indians by classing them with the Kaffirs. Now there is no occasion to perpetuate a needless insult. 
In September of the same year, in a famous meeting in South Africa where Gandhi launched the Satyagraha campaign, Resolution II passed at the meeting contained a reference to the same insult, this time occurring in the recently passed Asiatic Law Amendment Ordinance:
It reduces British Indians to a status lower than that of the aboriginal races of South Africa and the Coloured people. 
In December of 1906 Gandhi took the drastic step of approaching prominent Englishmen to gain support for his contention that Indians should not be considered equal to the Kaffirs:
The last week has been very busy. We have not had a moments leisure. We saw Mr. Theodore Morison of Aligarh and the well-known Mr. Stead of the Review of Reviews. Mr. Stead has boldly come out to give us all the help he can. He was therefore requested to write to the same Boer leaders that they should not consider Indians as being on the same level as Kaffirs. 
When Gandhi began the Satyagraha movement in 1906, he continually emphasized that sufferingmore so the enjoyment of the sufferingand jail time were completely necessary for the movement to succeed. One would naturally expect Gandhi to have had no qualms at all about his jail time. But that was not the case, and Gandhis issues with the jail stemmed from his close proximity to the Kaffirs:
CLASSIFICATION OF ASIATICS WITH NATIVES
The cell was situated in the Native quarters and we were housed in one that was labeled For Coloured Debtors. It was this experience for which we were perhaps all unprepared. We had fondly imagined that we would have suitable quarters apart from the Natives. As it was, perhaps, just as well that we were classed with Natives. We would now be able to study the life of Native prisoners, their customs and manners. . . . Degradation underlay the classing of Indians with natives. The Asiatic Act seemed to me to be the summit of our degradation. It did appear to me, as I think it would appear to any unprejudiced reader, that it would have been simple humanity if we were given special quarters. . . . the Governor of the gaol tried to make us as comfortable as he could . . . But he was powerless to accommodate us beyond the horrible din and the yells of the Native prisoners throughout the day and partly at night also. Many of the native prisoners are only one degree removed from the animal and often created rows and fought amongst themselves in their cells. 
Its quite clear from the above Indian Opinion article that Gandhi was not pleased with his stay in the jail. Perhaps Gandhi could only enjoy suffering when Blacks were not present! In another article in that days Indian Opinion, Gandhi further elaborated his views on Kaffirs:
. . . We were then marched off to a prison intended for Kaffirs.
INDIANS ON PAR WITH KAFFIRS
There, our garments were stamped with the letter N, which meant that we were being classed with the Natives. We were all prepared for hardships, but not quite for this experience. We could understand not being classed with the whites, but to be placed on the same level with the Natives seemed too much to put up with. I then felt that Indians had launched on passive resistance too soon. Here was further proof that the obnoxious law was intended to emasculate the Indians.
It was, however, as well that we were classified with the Natives. It was a welcome opportunity to study the treatment meted out to the Natives, their conditions [of life in the gaol] and their habits. . . . We were given a separate ward because we were sentenced to simple imprisonment; otherwise we would have been in the same ward [with the Kaffirs]. Indians sentenced to hard labour are in fact kept with the Kaffirs.
Apart from whether or not this implies degradation, I must say it is rather dangerous. Kaffirs are as a rule uncivilizedthe convicts even more so. They are troublesome, very dirty, and live almost like animals. Each ward contains nearly 50 to 60 of them. They often started rows and fought among themselves. The reader can easily imagine the plight of the poor Indian thrown into such company! 
Gandhi has just proclaimed an entire race to be uncivilized. Such a myopic statement from the Mahatma, supposedly one of the greatest men of the 20th century, if one were to believe media hype. Note he is not talking merely about the convicts.
Complaining about the situation in the jails, when going to the jail had been one of Gandhis goals in his suffering campaigns, is the height of irony. Taking it a step further the next year, 1909, Gandhi started an agitation solely for the purpose of separating Indian prisoners from Kaffir prisoners!
I have, though, resolved in my mind on an agitation to ensure that Indian prisoners are not lodged with Kaffirs or others. When I arrived at the place, there were about 15 Indian prisoners. Except for three, all of them were satyagrahis. The three were charged with other offences. These prisoners were generally lodged with kaffirs. When I reached there, the chief warder issued an order that all of us should be lodged in a separate room. I observed with regret that some Indians were happy to sleep in the same room as the Kaffirs, the reason being that they hoped there for a secret supply of tobacco, etc. This is a matter of shame to us. We may entertain no aversion to the Kaffirs, but we cannot ignore the fact that there is no common ground between them and us in the daily affairs of life. Moreover, those who wish to sleep in the same room have ulterior motives for doing so. Obviously, we ought to abandon such notions if we want to make progress. 
What an absurd situation Gandhi wanted in South Africa. On the one hand, he wanted Indians to go to jail and suffer so that they can get better laws. Yet the great sufferer Mohandas Gandhi could not stomach the fact that he had to live with Black prisoners, and so of all the absurdities, he starts an agitation. This leads directly to the point that Gandhi should be considered a segregationist, someone whowhile secretly worshipping white men and imitating most of their world viewsstill could understand being segregated from them, and desired segregation from the Blacks, even in prison. His writings clearly show that he had no objection to being placed below the whites, as long as Indians were viewed as superior to Blacks. He was opposed to interaction with the lower Blacks, yet defended the interactions of Indians with higher Whites, all the while maintaining his belief in purity of type. Is this not similar to a caste system?
Hence we come to modern South Africa, where Indians are once again stuck in the middle, this time with Blacks in power; being hated by Blacks for their century long political positionsstarting with Gandhis Congressagainst blacks, previously hated by whites for skin color. Of course one cannot say that Gandhis views were contrary to the opinion at large of his community, or that he is solely to blame for hostilities between the two communities. However, he did nothing to change attitudes or relations between the two, instead creating a terrible political precedentfor South African Indians and for himselfby being openly hostile to the majority community and being subservient to a powerful and vocal minority.
Gandhis views of Blacks gives the lavish praise of him by Black South African leadersincluding Nelson Mandelaa touch of irony. But more ironic was Gandhis use of the term Kaffir, which Whites in Africa had actually picked up from Muslims; Kaffir being the Koranic term for unbelievers, who are not viewed kindly in the Koran, to say the least. Gandhi, of course, was officially a Hindu, a set of people whom the term Kaffir is most applicableor perhaps, punishableaccording to the Muslim world-view.
 Collected works of MK Gandhi, Vol. 1, pg 150-151
. Petition to Lord Ripon, CWOMG, Vol. 1, pg 199-200
 Address in Bombay, CWOMG, Vol. 2, pg 74
 Notes on Test Case, CWOMG, Vol. 3, pg 8
 Indian Opinion, 9-7-1903, CWOMG Vol. 3, pg 359-360
 Petition to Natal Legislature, CWOMG, vol3, pg 330
 Indian Opinion 24-9-1903, CWOMG Vol. 3, pg 453
 The Transvaal Chambers and British Indians, Indian Opinion 24-12-03, CWOMG Vol. 4, pg 89
 Indian Opinion, 10-4-04, CWOMG Vol. 4, pg 130-131
 Indian Opinion 8-10-1904, CWOMG Vol. 4 pg 276
 What is a Coolie, Indian Opinion 2151904, CWOMG Vol. 4, pg 193
 Letter to Private Secretary to Lord Elgin, CWOMG Vol. 6, pg 198
 Indian Opinion, 29-2-1908, CWOMG Vol. 8, pg 105
 Indians in the O.R.C, Indian Opinion, 6-1-1906, CWOMG, Vol. 5, pg 177-178
 Indian Opinion 15-9-1906, CWOMG Vol. 5, pg 419-423
 Indian Opinion, 15-12-1906, CWOMG Vol. 6, pg 183
 Indian Opinion 7-3-1908, CWOMG Vol. 8, pg 120
 Indian Opinion, 7-3-1908, CWOMG Vol. 8, pg 135
 Indian Opinion, 6-1-1909, CWOMG Vol. 9, pg 149