Genesis 20:4 is remarkable for how boldly Abimelech speaks back to Heaven. Targum Pseudo-Jonathan:

"But Abimelek had not come nigh to defile her; and he said, Lord, shall the son of a people who hath not sinned, and whom it is right to absolve in the judgment, be killed?"

Abimelech had taken Sarah into his household but, the Targum insists, had not approached her physically. His protest is therefore legal. He presents himself as a defendant making a case before a cosmic court: the crime I am accused of I have not actually committed, and my people are innocent, and the right judicial outcome is acquittal.

The rabbis of Bereshit Rabbah and Targum Pseudo-Jonathan both pay close attention to Abimelech's phrase "the son of a people who hath not sinned." He is pleading not only for himself but for his whole kingdom — a whole nation — that had nothing to do with his decision to take Sarah. This is the first time in Torah a gentile king pleads collective innocence before the God of Israel. It will not be the last.

Notice the echo of Abraham's own bargaining two chapters earlier: "Shall the Judge of all the earth not do justice?" (Genesis 18:25). Abimelech is, in a way, using Abraham's own argument back on Abraham's own God — without knowing that Abraham invented the move.

This is one of the strangest small miracles of the whole Abraham cycle. The patriarch who had the courage to argue with Heaven also draws out the same courage in the gentile king whose house he has accidentally endangered. Righteousness, the Targum quietly teaches, is contagious even when the carrier has just made a mistake.

The takeaway: even a flawed man of God can accidentally teach a foreign king how to pray.