It was narrated from Ibn 'Abbas, who attributed it to the Prophet (ﷺ):
"Whoever kills out of folly or for tribal motives, using a rock, a whip, or a stick; he must pay the blood money for killing by mistake. Whoever kills deliberately, he is to be killed in retaliation. Whoever tries to prevent that, upon him is the curse of Allah, the angels and all the people, and no change nor equitable exchange will be accepted from him."
English reference: Vol. 3, Book 21, Hadith 2635
Arabic reference: Book 21, Hadith 2737