Why did God kill Ahaziah?


For asking Baalzebub if he would recover from his fall

Ahaziah fell down through a lattice in his upper chamber that was in Samaria, and was sick: and he sent messengers, and said unto them, Go, enquire of Baalzebub the god of Ekron whether I shall recover of this disease. ...

Now therefore thus saith the LORD, Thou shalt not come down from that bed on which thou art gone up, but shalt surely die. ...

Thus saith the LORD, Forasmuch as thou hast sent messengers to enquire of Baalzebub ... thou shalt not come down off that bed on which thou art gone up, but shalt surely die.

So he died according to the word of the LORD which Elijah had spoken. 2 Kings 1:1-17