In his autobiography The Story of My Experiments with Truth in the chapter on Raychandbhai, Gandhi says three moderns left a deep impress on him: Raychandbhai through living contact, Tolstoy through The Kingdom of God Is Within You, and Ruskin through Unto This Last. Thoreau belongs to the wider story, since Gandhi read Civil Disobedience in South Africa and discusses it in Satyagraha in South Africa. But he explicitly denied deriving his method from Thoreau, saying the South African movement was well advanced before he read the essay. Thoreau confirmed and gave a name to something Gandhi was already doing.
Each of the three answers a different question.
Raychandbhai (Shrimad Rajchandra) gave Gandhi his interior life. A Jain jeweller-poet-seer, he met the young Gandhi in Bombay in 1891 and became a steadying presence during Gandhi’s crisis of faith in South Africa, when Christian friends were pressing conversion. His counsel was to look deeper into Hinduism before leaving it. Gandhi never made him a guru, because he never found the perfectly realized one he thought a guru must be, but he credited him with showing that a person of intense worldly engagement could be wholly absorbed in the Self. For an Advaitin, this is the most interesting figure, since the Atmasiddhi is a text of self-realization.
Tolstoy supplied the logic of nonviolence. The Kingdom of God Is Within You argued that the Sermon on the Mount, taken seriously, dissolves the authority of the state’s coercion, and that love is the only force that does not corrupt its user. It gave Gandhi an intellectual vocabulary for ahimsa that was not merely inherited, and the two later corresponded.
Ruskin supplied the economics and the way of life. Gandhi read Unto This Last on a train journey and said it transformed him overnight. He took three lessons from it: the good of the individual is contained in the good of all, a lawyer’s work and a barber’s have equal worth, and the life of labour is the life worth living. These became Sarvodaya and the Phoenix Settlement, where he began living them.
Together the three form something like inner realization, ethical principle and social practice, and Gandhi’s distinctiveness lies in refusing to separate them. Thoreau, by contrast, supplied a precedent for the individual conscience against the state, which is why his influence is real but secondary.