I would like to share my answer to a Quora question. The answer focuses on how Mahatma Gandhi’s nonviolence was in full agreement with the instruction given by Lord Krishna (to Arjuna) in the Bhagavad Gita. The full answer can be read on this page.
The Bhagavad Gita does not support violence but teaches human beings about (1) goodness as opposed to ignorance, (2) following dharma (this includes responsibilities and righteousness), and (3) the significance of surrendering to God with love. The Gita fully supports a comprehensive definition of ahimsa.
Mahatma Gandhi, a devotee of Lord Rama who had learned to surrender to Lord Rama (God), did what was inspired by God. For his circumstances (desh-kala-paristhiti; location-time-situation), God inspired him to follow a version of ahimsa that did not include war. Earlier, the same Lord, during his appearance on Earth as Lord Krishna, had instructed Arjuna to follow a version of ahimsa that included engagement in battle. Participation in a war, when it became inevitable (read about Krishna’s peace proposal here), was in line with Arjuna’s dharma.
While Arjuna had chosen to be a warrior by profession, Gandhi never made that choice. Gandhi’s dharma considerably differed from that of Arjuna. A single solution does not fit every situation. We should be happy that Gandhi’s path, which was highly spiritually advanced, worked, and Lord Rama blessed India with the results that they were looking for.
Happy Gandhi Jayanti!
 The Hindi verse shown in the image is from the Dohavali by Goswami Tulasidasa (published by Gita Press.) My English translation: “Lord Rama (God) is beyond knowledge and the senses; he is indescribable. He is unborn and transcends the mind, illusion, and nature. The Lord, whose attributes include Truth, Consciousness, and Bliss, has performed illustrious divine plays on Earth as a human being.” This translation was originally published at this site.