How could a loving God take the life of David's child because of the sin of David? - 2 Samuel 12:15-23

Question
God is love (1 John 4:8). So how could God take the life of David's son because of David's sin? 2 Samuel 12:15-23
Answer
2 Samuel 12:15-23 After Nathan had gone home, the LORD struck the child that Uriah's wife had borne to David, and he became ill. David pleaded with God for the child. He fasted and went into his house and spent the nights lying on the ground. The elders of his household stood beside him to get him up from the ground, but he refused, and he would not eat any food with them. On the seventh day the child died. David's servants were afraid to tell him that the child was dead, for they thought, "While the child was still living, we spoke to David but he would not listen to us. How can we tell him the child is dead? He may do something desperate." David noticed that his servants were whispering among themselves and he realized the child was dead. "Is the child dead?" he asked. "Yes," they replied, "he is dead." Then David got up from the ground. After he had washed, put on lotions and changed his clothes, he went into the house of the LORD and worshiped. Then he went to his own house, and at his request they served him food, and he ate. His servants asked him, "Why are you acting this way? While the child was alive, you fasted and wept, but now that the child is dead, you get up and eat!" He answered, "While the child was still alive, I fasted and wept. I thought, 'Who knows? The LORD may be gracious to me and let the child live.' But now that he is dead, why should I fast? Can I bring him back again? I will go to him, but he will not return to me."

A loving holy God judges sin, or he would not be God (If God is Love). Judgment may come in various forms - some severe and some not so severe, some temporary and some eternal. So, God is not only 100% love (John 3:16), but 100% judge (John 3:18; Ps 9:7; 50:3-6; 96:13; Luke 12:2-5; Acts 10:42; 2 Pet 2:4-9; Rev 20:11-15), and he judges righteously (Gen 18:25). God is holy, and as such, he may not deny his nature and so must judge the sins of which all men have partaken (Rom 3:23).

David's son is in heaven (When an infant dies?). Because of David's sin, his son was probably spared a life of perpetual sorrow, and thus God here should be viewed as not only a judge of sin, but a merciful judge as well.

Answer by Dr. Joseph R. Nally, Jr.

Dr. Joseph R. Nally, Jr., D.D., M.Div. is the Theological Editor at Third Millennium Ministries (Thirdmill).