David inquired of the Lord--most probably through Gad (Sa2 24:11; Ch1 21:9), who was present in David's camp (Sa1 22:5), probably by the recommendation of Samuel. To repel unprovoked assaults on unoffending people who were engaged in their harvest operations, was a humane and benevolent service. But it was doubtful how far it was David's duty to go against a public enemy without the royal commission; and on that account he asked, and obtained, the divine counsel. A demur on the part of his men led David to renew the consultation for their satisfaction; after which, being fully assured of his duty, he encountered the aggressors and, by a signal victory, delivered the people of Keilah from further molestation.