1 Samuel 18:13

Therefore Saul removed him from him, and made him his captain over a thousand; and he went out and came in before the people.

Saul removed David from his immediate presence because he feared David's growing favor with the people. The removal took the form of appointing David as captain, or commander, over a thousand soldiers. David then served and led openly among the people, going out and coming in before them and directing their military affairs and movements.

The appointment placed important responsibilities upon him, yet he remained modest. The people recognized his competence, for his counsel was wise and discreet and his management skillful, so that his decisions were safe to follow. Through this service he gained the affection of the people and of the royal household.