(And verily We tried Solomon) by the loss of his kingdom for 40 days, the number of days in which the idols were worshipped in his house, (and set upon his throne a (mere) body) a devil. (Then did he repent) then did he return to his kingdom and to the obedience of his Lord and repented from his sin.