2 Samuel 18:4

And the king said unto them, What seemeth you best I will do. And the king stood by the gate side, and all the people came out by hundreds and by thousands.

Cross-reference

2 Samuel 18:1 Historical context

2 Samuel 18:1 shows David mustering and organizing the army before the battle, leading to his decision to stay at the gate.

2 Samuel 18:24 shows David waiting anxiously at the gate, the consequence of his decision to stay behind.

2 Samuel 19:8 shows David again sitting at the gate after victory, receiving the people — a bookend to his stance before battle.