That was the reason! “And we know that all things work together for good to them that love God, to them who are the called according to His purpose.” - Romans 8:28 (KJV)
He fell spectacularly. “For Solomon went after Ashtoreth the goddess of the Zidonians, and after Milcom the abomination of the Ammonites." - 1 Kings 11:5 (KJV)