After he had counted the people David's heart convicted him of this sin, so he repented before the Lord , the Lord then sent Gad the prophet to him with a choice, David was going to be judged for his sin but he had a choice what that judgement was to be, famine, war or plague. It was highly likely that the famine and the war would not have touched David directly so he chose the punishment of the plague. Famine and war would also have meant that he would have to rely on man for help but he chose to fall into the hands of the Lord as His mercy is great. In the plague which lasted 3 days 70,000 people died but thatnks to the mercy of God the plague was stopped when the Angel of the Lord was at the threshing floor of Araunah the Jebusite. David bought the threshing floor and errected an altar on it as the Lord commanded, this was the same land where Abraham offered Isaac, Solomon built the temple and the Lord Jesus bled and died for us.