The Prophet Muhammad (bpuh) was forced to leave Makkah, the place of his family, children, and home. He sought refuge in At- Ta'aif, where he was treated with contempt: the elders cursed him, and the children mocked him and pelted him with stones.
Tears of sorrow poured down his face and his feet bled. Where was he to turn? Where was he to seek refuge? The only One in whom one may seek refuge is Allah, the Almighty.
Muhammad (bpuh) faced the Ka'bah, thanked Allah, praised Him, and invoked Him to help him through his difficulties. Read this, his supplication to his Lord after his experience in At-Ta'aif:
"O' Allah, I complain to you of my weakness, my lack of options, and the contempt of people for me. You are the Most Merciful, You are my Lord; to whom do you entrust me with: To my relatives who are coarse with me or to an enemy that you have made to subjugate me. If you are not angry with me, then I don't care (how people treat me), except that safety from you is easier for me. i seek refuge with the illumination of Your Face, which has the effect of making darkness shine, and of making good the affairs of this world and the Hereafter, from having your anger descend upon me, or your wrath come down upon me. I blame myself (and will continue in my efforts to please you) until you are pleased. And there is no movement (in the universe) or strength except with you."