David is still more blameworthy on account of the census which he took of the Israelites in defiance of the law in the Pentateuch. When he was charged by the king with the task of numbering the people, Joab used every effort to turn him away from his intention. But in vain. Incensed, David said: "Either thou art king and I am the general, or I am king and thou art the general."
Joab had no choice but to obey. He selected the tribe of Gad as the first to be counted, because he thought that the Gadites, independent and self-willed, would hinder the execution of the royal order, and David would be forced to give up his plan of taking a census. The Gadites disappointed the expectations of Joab, and he betook himself to the tribe of Dan, hoping that if God's punishment descended, it would strike the idolatrous Danites.
Disliking his mission as he did, Joab spent nine months in executing it, though he might have dispatched it in a much shorter time. Nor did he carry out the king's orders to the letter. He himself warned the people of the census. If he saw the father of a family of five sons, he would bid him conceal a few of them.
Following the example set by Moses, he omitted the Levites from the enumeration, likewise the tribe of Benjamin, because he entertained particularly grave apprehensions in behalf of this greatly decimated tribe. In the end, David was not informed of the actual number obtained. Joab made two lists, intending to give the king a partial list if he found that he had no suspicion of the ruse.