And whosoever takes Allah, His Messenger, and those who have believed, as protectors, then the party of Allah will be the victorious.
similarly Allah said;
كَتَبَ اللَّهُ لاّغْلِبَنَّ أَنَاْ وَرُسُلِى إِنَّ اللَّهَ قَوِىٌّ عَزِيزٌ
لااَّ تَجِدُ قَوْماً يُوْمِنُونَ بِاللَّهِ وَالْيَوْمِ الااٌّخِرِ يُوَادُّونَ مَنْ حَأدَّ اللَّهَ وَرَسُولَهُ وَلَوْ كَانُواْ ءَابَأءَهُمْ أَوْ أَبْنَأءَهُمْ أَوْ إِخْوَنَهُمْ أَوْ عَشِيرَتَهُمْ أُوْلَـيِكَ كَتَبَ فِى قُلُوبِهِمُ الااِيمَـنَ وَأَيَّدَهُمْ بِرُوحٍ مِّنْهُ وَيُدْخِلُهُمْ جَنَّـتٍ تَجْرِى مِن تَحْتِهَا الااٌّنْهَـرُ خَـلِدِينَ فِيهَا رَضِىَ اللَّهُ عَنْهُمْ وَرَضُواْ عَنْهُ أُوْلَـيِكَ حِزْبُ اللَّهِ أَلااَ إِنَّ حِزْبَ اللَّهِ هُمُ الْمُفْلِحُونَ
Allah has decreed: "Verily, it is I and My Messengers who shall be the victorious." Verily, Allah is All-Powerful, Almighty.
You will not find any people who believe in Allah and the Last Day, making friendship with those who oppose Allah and His Messenger, even though they were their fathers or their sons or their brothers or their kindred (people). For such He has written faith in their hearts, and strengthened them with a Ruh (proof) from Himself. And He will admit them to Gardens (Paradise) under which rivers flow to dwell therein (forever). Allah is pleased with them, and they with Him. They are the party of Allah. Verily, it is the party of Allah that will be the successful. (58:21-22)
Therefore, those who accept the allegiance of Allah - His Messenger and the faithful believers - will gain success in this life and the Hereafter. Hence Allah's statement here,
وَمَن يَتَوَلَّ اللّهَ وَرَسُولَهُ وَالَّذِينَ امَنُواْ فَإِنَّ حِزْبَ اللّهِ هُمُ الْغَالِبُونَ
(And whosoever takes Allah, His Messenger, and those who have believed, as protectors, then the party of Allah will be the victorious).