When the young Indian lawyer Mohandas K. Gandhi set sail in 1893 for Durban, the main port in Britain’s colony in Natal in southeast Africa, he expected his assignment to last no more than a year. Having found it difficult to establish a legal practice in his hometown in Gujarat, he had accepted a short-term commission to assist a Muslim merchant in Durban who was in a financial dispute with another Muslim merchant in Pretoria, capital of the neighboring Boer republic of Transvaal.

Recently qualified in law at the Inner Temple in London, Gandhi at 24 was a firm believer in the superiority of British justice and British institutions and regarded himself as a loyal citizen of the British Empire. But in Africa he was soon caught up in the maelstrom of its racial politics and spent two decades there fashioning new techniques of mass civil disobedience that were eventually used to challenge the might of the British Empire.

As the historian Ramachandra Guha emphasizes in “Gandhi Before India,” his career as a political activist and thinker was shaped largely by his experiences in South Africa. So much so that Mr. Guha, the author of “India After Gandhi,” has devoted his new book, the first of a projected two-part biography, to this early part of his life. He has compiled a wealth of evidence, much of it from private correspondence not previously published. But his thoroughness leads him to dwell on this central theme. A slimmer volume would have been more effective.

Gandhi came from an insular, middle-class family in Gujarat, immersed in its own world of Hindu rituals and customs. Mr. Guha maintains that if Gandhi had not accepted the assignment in Africa, he would probably have remained in the same narrow milieu.