The purpose of Lord Krishna’s birth on earth was to remove evil and restore peace and dharma (virtue). He came to earth to spread the message to the world that those who are on the path of truth will achieve victory. He was clear that he wouldn’t hesitate for once to do anything to save virtue on earth.

That is why in Mahabharata there are incidents when Lord Krishna resorted to deception or trickery when there was no other choice to win over the evil souls. According to him, committing a sin for the purpose of dharma is no sin at all.

Let us see some of the events in Mahabharata where he backed trickery and dishonesty, to win over his evil enemies.
Killing of Bhishma

Bhishma was an unparalleled archer and Arjuna had no power or knowledge to even bother him slightly. Clearly, only a strategy could defeat Bhishma. Krishna knew that Bhishma would not attack a female form, and thus made Arjuna use Shikhandi, who was born as female, as a shield.
Killing of Dronacharya

It was well known that defeating Dronacharya was not possible when he had bow and arrow in his hands. So, Krishna’s strategy once again changed the game. He devised a plan in which Bhima killed the elephant Ashvatthama and Yudhisthir shouted “Asvatthama is dead” to create a false impression in Drona’s mind that his own son Ashvatthama has died. This made Drona to keep down his bow in shock and was immediately killed.
Killing of Jayadratha

Arjuna made a vow to kill Jayadratha before sunset and decided to burn himself in case of failure to do so. The Kauravas made a massive shield around Jayadratha, which was impossible to break before sunset. So Krishna requested Yogamaya, the Goddess of maya (illusion), to create an illusion of sunset.

This made Jayadratha to come out of the shield to see Arjuna burning himself. The moment this happened, the Goddess removed the illusion and Arjuna killed Jayadratha.
Ghatotkach as a trap to save Arjuna

Krishna knew well that Arjuna’s rival Karna has a powerful weapon (Vasava Shakti) that could easily kill him. To save him, Krishna asked Ghatotkach to attack Duryodhan so severely that Karna is forced to use that powerful weapon on him and hence, Arjuna will be saved from that weapon. Ghatotkach did the same and Arjuna’s life was saved.
Killing of Karna

It was impossible to defeat Karna as long as he was standing on his chariot with weapons in his hands. During the war, Arjuna fired a bow on Karna’s chariot that got it stuck deep inside the earth. Unable to fight, Karna went down to life his stuck chariot out. This was the time when he was weaponless and Krishna took no time to react.

He immediately asked Arjuna to kill him instantly. Arjuna beheaded him by firing a powerful arrow on Karna’s neck.