Solomon made an alliance with Pharaoh king of Egypt by marrying Pharaoh's daughter. Solomon brought her to the city of David until he finished building his palace, the Lord's temple, and the wall surrounding Jerusalem.
However, the people were sacrificing on the high places, because until that time a temple for the Lord's name had not been built.
Solomon loved the Lord by walking in the statutes of his father David, but he also sacrificed and burned incense on the high places.
The king went to Gibeon to sacrifice there because it was the most famous high place. He offered 1,000 burnt offerings on that altar.
At Gibeon the Lord appeared to Solomon in a dream at night. God said, "Ask. What should I give you?"
And Solomon replied, "You have shown great and faithful love to Your servant, my father David, because he walked before You in faithfulness, righteousness, and integrity. You have continued this great and faithful love for him by giving him a son to sit on his throne, as it is today.
"Lord my God, You have now made Your servant king in my father David's place. Yet I am just a youth with no experience in leadership.
Your servant is among Your people You have chosen, a people too numerous to be numbered or counted.
So give Your servant an obedient heart to judge Your people and to discern between good and evil. For who is able to judge this great people of Yours?"
Now it pleased the Lord that Solomon had requested this.
So God said to him, "Because you have requested this and did not ask for long life or riches for yourself, or the death of your enemies, but you asked discernment for yourself to understand justice,
I will therefore do what you have asked. I will give you a wise and understanding heart, so that there has never been anyone like you before and never will be again.
In addition, I will give you what you did not ask for: both riches and honor, so that no man in any kingdom will be your equal during your entire life.
If you walk in My ways and keep My statutes and commandments just as your father David did, I will give you a long life."
Then Solomon woke up and realized it had been a dream. He went to Jerusalem, stood before the ark of the Lord's covenant, and offered burnt offerings and fellowship offerings. Then he held a feast for all his servants.