So Achish called David and said to him, "As surely as the Lord lives, you have been reliable, and I would be pleased to have you serve with me in the army. From the day you came to me until now, I have found no fault in you, but the rulers don't approve of you. Turn back and go in peace; do nothing to displease the Philistine rulers." 1 Samuel 29:6-7
David could be pretty sly.
When threatened by Saul, he struck a deal with Achish, one of his enemies; essentially he hid in plain sight, for Saul would not chase David while he was living among the Philistines. Then keeping up a charade, he and his men raided other enemies nearby claiming they were attacking Israelite cities. This helped David maintain an image - that he could be trusted.
All along, David's allegiance had not changed. Despite Saul's contempt, David loved him and honored him as God's anointed king. The very people he claimed to have been raiding were his people. Someday they would be citizens of David's kingdom, living under his protection. How could he do anything to cause them harm? What could he do if Achish asked him to fight alongside him against the Israelites? He would be forced to make a choice - to keep up the charade or to fight against his own people.
Although Scripture doesn't record the conversation, I'm sure David asked the Lord for help when that day came. Achish expected David to fight with him when the Philistines gathered for battle. Now, what could David do? Obviously, he did what he should have done. He trusted, and God took care of it. The other Philistine rulers would have nothing to do with David, and they refused to let him join the battle. David didn't have to choose. The Lord had chosen for him.
Lord, there are times that I should merely trust You. Could I be as strong as David - to suit up for battle, not knowing if I will be forced to choose between good and bad? Help me to trust that You know what You are doing every single day.