A successful leader must carefully balance political wisdom with spiritual loyalty. For King Solomon, future success depends entirely on a single condition: that God actually grants him the required wisdom [מלבי״ם]. This divine gift of wisdom and understanding is meant to support two distinct areas of the king's responsibility.
The first area involves the practical leadership of the nation. God appoints the king to rule the state properly [ביאור שטיינזלץ], providing him with the intelligence needed to guide the people with fairness and to judge them with true justice [רלב״ג, מלבי״ם]. Another perspective suggests that the very gift of understanding, knowing exactly how to direct and instruct the nation, is considered as if God Himself is directly placing him in charge of Israel [מצודת דוד].
The second area of responsibility focuses on spiritual devotion. Divine wisdom and understanding are necessary not only for managing the country but also for properly observing the Torah [מצודת דוד]. Ultimately, strict adherence to all of God's commandments serves as the true guarantee for the king's lasting success [רלב״ג].