But the king commanded Joab and his officers to do it. So they left the king and went out to count the people of Israel.