There was a famine for three years in a row during David's rule. David asked the LORD about this, and the LORD said, "It is caused by Saul and his household, who are guilty of bloodshed because he killed the people of Gibeon."
So the king called for the Gibeonites and spoke to them. (Now the Gibeonites weren't Israelites but were survivors of the Amorites. The Israelites had sworn a solemn pledge to spare them, but Saul tried to eliminate them in his enthusiasm for the people of Israel and Judah.)
David said to the Gibeonites, "What can I do for you? How can I fix matters so you can benefit from the LORD's inheritance?"
The Gibeonites said to him, "We don't want any silver or gold from Saul or his family, and it isn't our right to have anyone in Israel killed." "What do you want?" David asked. "I'll do it for you."
"Okay then," they said to the king. "That man who opposed and oppressed us, who planned to destroy us, keeping us from having a place to live anywhere in Israel—
hand over seven of his sons to us, and we will hang them before the LORD at Gibeon on the LORD's mountain." "I will hand them over," the king said.
But the king spared Mephibosheth, Jonathan's son and Saul's grandson, because of the LORD's solemn pledge that was between them—between David and Saul's son Jonathan.
So the king took the two sons of Aiah's daughter Rizpah, Armoni and Mephibosheth, whom she had birthed for Saul; and the five sons of Saul's daughter Merab, whom she birthed for Adriel, Barzillai's son, who was from Meholah,
and he handed them over to the Gibeonites. They hanged them on the mountain before the LORD. The seven of them died at the same time. They were executed in the first days of the harvest, at the beginning of the barley harvest.
Aiah's daughter Rizpah took funeral clothing and spread it out by herself on a rock. She stayed there from the beginning of the harvest until the rains poured down on the bodies from the sky, and she wouldn't let any birds of prey land on the bodies during the day or let wild animals come at nighttime.
When David was told what Aiah's daughter Rizpah, Saul's secondary wife, had done,
he went and retrieved the bones of Saul and his son Jonathan from the citizens of Jabesh-gilead, who had stolen the bones from the public square in Beth-shan, where the Philistines had hanged them on the day the Philistines killed Saul at Gilboa.
David brought the bones of Saul and his son Jonathan from there and collected the bones of the men who had been hanged by the Gibeonites.
The bones of Saul and his son Jonathan were then buried in Zela, in Benjaminite territory, in the tomb of Saul's father Kish. Once everything the king had commanded was done, God responded to prayers for the land.