David came to Nob where Ahimelech was priest. Ahimelech was shaking in fear when he met David. "Why are you alone? Why is no one with you?" he asked.
References for 1 Samuel 21:1
David answered Ahimelech the priest, "The king has given me orders, but he instructed me, ‘Don't let anyone know anything about the mission I'm sending you on or about your orders.' As for my troops, I told them to meet me at an undisclosed location.
Now what do you have here with you? Give me five loaves of bread or whatever you can find."
"I don't have any regular bread on hand," the priest answered David, "just holy bread—but only if your troops have abstained from sexual activity."
"Definitely," David answered the priest. "Whenever I go out to war, women are off-limits; that's our standard operating procedure. Even on regular missions, the men's gear is kept holy. That's even more true today, with the mission holy along with the gear."
References for 1 Samuel 21:5
So the priest gave David holy bread, because there was no other bread except the bread of the presence, which is removed from the LORD's presence and replaced by warm bread as soon as it is taken away.
Now one of Saul's servants was there that day, detained in the LORD's presence. His name was Doeg. He was an Edomite and Saul's head shepherd.
David asked Ahimelech, "Do you have a spear or sword on hand? I didn't bring my sword or gear with me because the king's mission was urgent."
The priest said, "The sword of Goliath, the Philistine you killed in the Elah Valley, is here wrapped in a cloth behind a priestly vest. If you want it, take it, because there are no other swords here." David said, "No sword is as good as that one! Give it to me!"
References for 1 Samuel 21:9
So David got up and continued running from Saul. He went to Achish, Gath's king.
References for 1 Samuel 21:10
Achish's servants said to him, "Isn't that David, king of the land? He's the one people sing about in their dances, ‘Saul has killed his thousands, but David has killed his tens of thousands!'"
David took these words very seriously and became very frightened of Achish, Gath's king.
So he changed the way he acted with them, pretending to be insane while he was with them. He scratched marks on the doors of the city gates and let spit run down his chin.
References for 1 Samuel 21:13
"Can't you see he's crazy?" Achish asked his servants. "Why bring him to me?
Am I short on insane people that you've brought this person to go crazy right in front of me? Do you really think I'm going to let this man enter my house?"