2 Samuel 11 opens by setting the stage for David's adulterous relationship with Bathsheba. David, instead of leading his troops, stayed back:
"It happened in the spring of the year, at the time when kings go out to battle, that David sent Joab and his servants with him, and all Israel; and they destroyed the people of Ammon and besieged Rabbah. But David remained at Jerusalem."