Tale of Two Cities: Gibeah and Keilah

The Bible has two interesting incidents; this is regarding two cities. Both took strange decisions.
Gibeah: How shocking would it be to receive a courier parcel with a part of the female body packed in it? (Judges 19:29) When the man was unfaithful to the Lord, the woman was unfaithful to him. She left him and stayed in her father’s home for about four months. He brought her home, and on the way had a stopover at Gibeah. Only an old immigrant gave shelter to the travellers. Some worthless fellows banged the door and wanted the strange man out to be sexually exploited. The pleading of the old man was of no use. The man pushed her concubine out. The wicked men gang-raped her and left her dead. (Judges 19:1-26) After that the couriers were dispatched to all tribes of Israel. All the other tribes gathered from Dan in the North and Beersheba in the South at Mizpah. The national council demanded the surrender of the wicked men. The Benjaminite’s condoned the sin of wicked men, defended them, and refused to surrender them for judgement. This resulted in a civil war in which more than 70000 people died. (Judges 20)

Keilah: City of Keilah was attacked by Philistines and they were robbing the threshing floors. David, who was in distress as Saul was pursuing heard about it. He prayed to the Lord about this, and God directed David to attack Philistine and save the city. David obeyed and saved the city. Saul was informed that David was inside the city of Keilah and he mustered his army to attack the city. David asked the Lord if Saul will attack the city and will the city people hand him over to Saul. Lord answered ‘Yes’ to both the questions. (I Samuel 23: 1-14)
Gibeah protected the wicked and was willing to go to war. Keilah failed to protect the righteous David and his men, who had contributed for the protection of their city.
Do I favour and protect the righteous or the wicked?