en.wikipedia.org
"Killing to save lives" is, uniquely amongst Buddhist schools, considered justified by certain Mahayana scriptures such as the Upaya-kaushalya Sutra, where, in a past life, Shakyamuni Buddha kills a robber intent on mass murder on a ship (with the intent both of saving the lives of the passengers and saving the robber from bad karma).
[40] K. Sri Dhammananda taught warfare is accepted as a last resort, quoting the Buddha's conversation with a soldier. The
14th Dalai Lama has also spoken on when it is permissible to kill another person. During a lecture he was giving at
Harvard University in 2009, the Dalai Lama invoked the Upaya-kaushalya Sutra and said that "wrathful forceful action" motivated by compassion, may be "violence on a physical level" but is "essentially nonviolence", and we must be careful to understand what "nonviolence" means.
[41]