Both Mahatma Gandhi and Nelson Mandela both saw that they shouldn't use violence to get their rights. They both went to jail along with the other protesters. After about 27 years spent in jail he was finally released. He then became the first black South African president. He is still a hero known by many in South Africa.
MLK was inspired by Mahatma Gandhi. For that reason he started a peaceful protest. A lot of people have joined him to get their rights that they deserve. Gandhi and MLK both wanted to get their rights and they did it by marching without any violence. MLK even said that Gandhi was the person who has inspired him to protest. Without Gandhi MLK might have not have done a protest to the unequal laws that they had to follow.
Mahatma Gandhi was a Hindu. He wanted peace for his people and wanted there to be equal rights for all. He believed that he shouldn't use violence to get his message across. Instead he used peace. He protested peacefully along with the others who decided to join him. A lot of them went to jail because of the laws that they have broken. That is how they protested peacefully. After awhile he finally got what he and others wanted. Of course he went to jail but he was successful.