I Samuel - Chapter 24
David Surprises Saul in the Facilities
David went to Ein Gedi. Shaul finished his business with the Philistines and resumed his pursuit of David. At one point, Shaul entered a particular cave in order to use it as a rest room, while David and his men were at the other end. David's men were ecstatic that G-d had delivered Shaul into their hands, but David felt otherwise. Despite everything, David said, Shaul was still G-d's anointed king. (As a future king himself, it would be imprudent for David to advocate assassination.)
While Shaul was relieving himself, David crept in and cut off a piece of Shaul's robe. He then called out to Shaul from a safe distance. "Why do you listen to people who tell you I'm an enemy?" David asked. "I could have done you harm, but I didn't. See? Here's a piece of your robe I cut off!" Shaul realized that David was right. He wept and called David his son. He acknowledged that David would eventually reign and asked that David not eradicate his descendants. David swore to this, then the two men parted and went their separate ways.