Another interpretation of (Psalms 37:15) "Their sword shall enter their own heart": These are the four kings, Amraphel and his companions, for until now there had been no war in the world. They came and opened with the sword, as it is said (Genesis 14:1), "And it came to pass in the days of Amraphel" — they began to make war. The Holy One, blessed be He, said to them: You are wicked! You have opened with the sword. Let the sword enter the heart of those same men, as it is said (Psalms 37:15), "Their sword shall enter their own heart." Immediately Abraham rose up against them and killed them, as it is said (Genesis 14:15), "And he divided himself against them by night."
Why Abraham Slew the Four Kings Who First Drew the Sword
Midrash Tanchuma Buber, Lech Lecha 7:3
ד"א חרבם תבא בלבם, אלו ארבעה מלכים אמרפל וחביריו, שעד עכשיו לא היתה מלחמה בעולם, ובאו ופתחו בחרב, שנאמר ויהי בימי אמרפל, התחילו לעשות מלחמה, אמר להם הקב"ה, רשעים אתם פתחתם בחרב, תבא החרב בלבם של אותם האנשים, שנאמר חרבם תבא בלבם, מיד עמד עליהם אברהם והרגן, שנאמר ויחלק עליהם לילה (בראשית יד טו).