Solomon became the son-in-law of Pharaoh, Egypt's king, when he married Pharaoh's daughter. He brought her to David's City until he finished building his royal palace, the LORD's temple, and the wall around Jerusalem.
Unfortunately, the people were sacrificing at the shrines because a temple hadn't yet been built for the LORD's name in those days.
Now Solomon loved the LORD by walking in the laws of his father David, with the exception that he also sacrificed and burned incense at the shrines.
The king went to the great shrine at Gibeon in order to sacrifice there. He used to offer a thousand entirely burned offerings on that altar.
The LORD appeared to Solomon at Gibeon in a dream at night. God said, "Ask whatever you wish, and I'll give it to you."
Solomon responded, "You showed so much kindness to your servant my father David when he walked before you in truth, righteousness, and with a heart true to you. You've kept this great loyalty and kindness for him and have now given him a son to sit on his throne.
And now, LORD my God, you have made me, your servant, king in my father David's place. But I'm young and inexperienced. I know next to nothing.
But I'm here, your servant, in the middle of the people you have chosen, a large population that can't be numbered or counted due to its vast size.
Please give your servant a discerning mind in order to govern your people and to distinguish good from evil, because no one is able to govern this important people of yours without your help."
It pleased the LORD that Solomon had made this request.
God said to him, "Because you have asked for this instead of requesting long life, wealth, or victory over your enemies—asking for discernment so as to acquire good judgment—
I will now do just what you said. Look, I hereby give you a wise and understanding mind. There has been no one like you before now, nor will there be anyone like you afterward.
I now also give you what you didn't ask for: wealth and fame. There won't be a king like you as long as you live.
And if you walk in my ways and obey my laws and commands, just as your father David did, then I will give you a very long life."
Solomon awoke and realized it was a dream. He went to Jerusalem and stood before the chest containing the LORD's covenant. Then he offered entirely burned offerings and well-being sacrifices, and held a celebration for all his servants.