1 Kings 9:1-9, 11:9-12 (ESV)

As soon as Solomon had finished building the house of the Lord and the king’s house and all that Solomon desired to build, the Lord appeared to Solomon a second time, as he had appeared to him at Gibeon. And the Lord said to him, “I have heard your prayer and your plea, which you have made before me. I have consecrated this house that you have built, by putting my name there forever. My eyes and my heart will be there for all time. And as for you, if you will walk before me, as David your father walked, with integrity of heart and uprightness, doing according to all that I have commanded you, and keeping my statutes and my rules, then I will establish your royal throne over Israel forever, as I promised David your father, saying, ‘You shall not lack a man on the throne of Israel.’ But if you turn aside from following me, you or your children, and do not keep my commandments and my statutes that I have set before you, but go and serve other gods and worship them, then I will cut off Israel from the land that I have given them, and the house that I have consecrated for my name I will cast out of my sight, and Israel will become a proverb and a byword among all peoples. And this house will become a heap of ruins. Everyone passing by it will be astonished and will hiss, and they will say, ‘Why has the Lord done thus to this land and to this house?’ Then they will say, ‘Because they abandoned the Lord their God who brought their fathers out of the land of Egypt and laid hold on other gods and worshiped them and served them. Therefore the Lord has brought all this disaster on them.’”

And the Lord was angry with Solomon, because his heart had turned away from the Lord, the God of Israel, who had appeared to him twice 10 and had commanded him concerning this thing, that he should not go after other gods. But he did not keep what the Lord commanded. 11 Therefore the Lord said to Solomon, “Since this has been your practice and you have not kept my covenant and my statutes that I have commanded you, I will surely tear the kingdom from you and will give it to your servant. 12 Yet for the sake of David your father I will not do it in your days, but I will tear it out of the hand of your son.