Now there was a famine in the days of David for three years, year after year; and David inquired of the Lord. The Lord said, "There is bloodguilt on Saul and on his house, because he put the Gibeonites to death."
So the king called the Gibeonites and spoke to them. (Now the Gibeonites were not of the people of Israel, but of the remnant of the Amorites; although the people of Israel had sworn to spare them, Saul had tried to wipe them out in his zeal for the people of Israel and Judah.)
David said to the Gibeonites, "What shall I do for you? How shall I make expiation, that you may bless the heritage of the Lord?"
The Gibeonites said to him, "It is not a matter of silver or gold between us and Saul or his house; neither is it for us to put anyone to death in Israel." He said, "What do you say that I should do for you?"
They said to the king, "The man who consumed us and planned to destroy us, so that we should have no place in all the territory of Israel—
let seven of his sons be handed over to us, and we will impale them before the Lord at Gibeon on the mountain of the Lord." The king said, "I will hand them over."
References for 2 Samuel 21:6
But the king spared Mephibosheth, the son of Saul's son Jonathan, because of the oath of the Lord that was between them, between David and Jonathan son of Saul.
References for 2 Samuel 21:7
The king took the two sons of Rizpah daughter of Aiah, whom she bore to Saul, Armoni and Mephibosheth; and the five sons of Merab daughter of Saul, whom she bore to Adriel son of Barzillai the Meholathite;
References for 2 Samuel 21:8
he gave them into the hands of the Gibeonites, and they impaled them on the mountain before the Lord. The seven of them perished together. They were put to death in the first days of harvest, at the beginning of barley harvest.
Then Rizpah the daughter of Aiah took sackcloth, and spread it on a rock for herself, from the beginning of harvest until rain fell on them from the heavens; she did not allow the birds of the air to come on the bodies by day, or the wild animals by night.
References for 2 Samuel 21:10
When David was told what Rizpah daughter of Aiah, the concubine of Saul, had done,
David went and took the bones of Saul and the bones of his son Jonathan from the people of Jabesh-gilead, who had stolen them from the public square of Beth-shan, where the Philistines had hung them up, on the day the Philistines killed Saul on Gilboa.
He brought up from there the bones of Saul and the bones of his son Jonathan; and they gathered the bones of those who had been impaled.
They buried the bones of Saul and of his son Jonathan in the land of Benjamin in Zela, in the tomb of his father Kish; they did all that the king commanded. After that, God heeded supplications for the land.