James 3:15

(James 3:15) This wisdom descendeth not from above, but is earthly, sensual, devilish.

The word "wisdom" refers to the power of discernment, not to good judgment or the discernment of truth.

(Ecclesiastes 1:18) For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.

Solomon was wise but his wisdom failed him because it was incomplete. People were impressed by his wisdom but his holiness and judgment were lacking. Often, Solomon is presented as one who was wise, but who fell from grace. But based on the meaning of the word "wisdom", there is no reason we need to believe that he fell from grace at all — rather, he was never particularly holy or righteous. Early in his reign we have the following verse:

(1 Kings 3:3) And Solomon loved the LORD, walking in the statutes of David his father: only he sacrificed and burnt incense in high places.

God granted true wisdom to Solomon:

(1 Kings 3:9,12) [Solomon:] Give therefore thy servant an understanding heart to judge thy people, that I may discern between good and bad: for who is able to judge this thy so great a people? [The Lord:] Behold, I have done according to thy words: lo, I have given thee a wise and an understanding heart; so that there was none like thee before thee, neither after thee shall any arise like unto thee.

But Solomon failed to remain true to his calling:

(1 Kings 3:14) And if thou wilt walk in my ways, to keep my statutes and my commandments, as thy father David did walk, then I will lengthen thy days.

(1 Kings 4:32) And he spake three thousand proverbs: and his songs were a thousand and five.

Solomon was able to compose wise sayings and write inspirational songs. Perhaps Martin Luther is right in claiming that our human wisdom is useless; that only our faith matters. Perhaps Solomon had human wisdom but lacked faith. It seems that he grew weary of his songwriting and wisdom — perhaps it lacked the Spirit of God.

(1 Kings 7:8) And his house where he dwelt had another court within the porch, which was of the like work. Solomon made also an house for Pharaoh's daughter, whom he had taken to wife, like unto this porch.

At the same time that Solomon was building the temple he also had multiple wives. God kept reminding him to live a holy life during this time:

(1 Kings 6:12) Concerning this house which thou art in building, if thou wilt walk in my statutes, and execute my judgments, and keep all my commandments to walk in them; then will I perform my word with thee, which I spake unto David thy father.

Solomon was able to compose the most inspirational of speeches even while living in sin. This reminds me of some Christian leaders who manage to hide their sin or who are just plain materialistic.

(1 Kings 8:23) And he said, LORD God of Israel, there is no God like thee, in heaven above, or on earth beneath, who keepest covenant and mercy with thy servants that walk before thee with all their heart.

Based on this word of the Lord, it is apparent that Solomon did not follow God's commands:

(1 Kings 9:6,7) But if ye shall at all turn from following me, ye or your children, and will not keep my commandments and my statutes which I have set before you, but go and serve other gods, and worship them: Then will I cut off Israel out of the land which I have given them; and this house, which I have hallowed for my name, will I cast out of my sight; and Israel shall be a proverb and a byword among all people.

In conclusion, the wisest man in the world was spiritually bankrupt. The wisest thing we can do is cling to the Lord and to call out to him for mercy continually.