The Rambam writes in the Laws of Idolatry, Chapter 10:
We do not end relations with idolaters, because we want to maintain peace with them, and let them continue their idolatry, as it says, "Do not end pacts with them". However, they must end their idolatry or they will be killed. In addition, it's forbidden to have mercy on them, as it says, "do not deal kindly with them". Therefore, if one sees an idolatrous non-Jew who is lost or drowning in a river one should not take him out. If one sees that he may die he should not be saved. But, it is forbidden to lead him astray or push him into a pit, that is if he is not waging war with us.From here we can derive three levels, or types of non-Jews:
From here one learns that it is forbidden to provide medical care for one who engages in idolatry even for the payment [of care] ... whereas for a righteous non-Jew, it is a commandment to help him and provide medical care for free.
A. A Righteous non-Jew: it is a commandment to sustain him, and is certainly forbidden to kill him.
B. A non-Jew who is not at war with us: It is forbidden to save him, and it is forbidden to kill him.
C. A non-Jew who is at war with us.
For a "righteous non-Jew" a Jew is commanded to sustain him - as the Rambam writes in the second law. And, so we have a clear source that forbids killing the righteous non-Jew. But, it is necessary to clarify the prohibition of killing a non-Jew who is not "righteous".