I have read somewhere that says mercy killing or euthanasia cannot be carried our without the ill-will of the perpetrator towards the fact of the patient’s suffering. Even though the motivation behind this action may have been good (e.g. to prevent further suffering for the patient), the thought that leads to action becomes an act of aversion.
So when a doctor performs mercy-killing, it is actually the patient’s pain and suffering which disturb his mind. Additionally, the doctor experiences negative emotions toward this disturbance and projects it on the suffering of the patient but disguises his real feeling as a moral deed to justify himself as mercy killing. Therefore, from the Buddhist view, mercy killing is an act of malevolent. It is done from ill will and thus has bad karmic effects both for the doctor and the patient.