Tafsir of ibn kathir:

Allah said,

﴿كَتَبَ اللَّهُ لاّغْلِبَنَّ أَنَاْ وَرُسُلِى﴾

Allah has decreed: "Verily, I and My Messengers shall be the victorious.'') meaning, He has decreed, written in the First Book, and decided in the decree that He has willed -- which can never be resisted, changed or prevented -- that final victory is for Him, His Book, His Messengers and the faithful believers, in this life and the Hereafter:

﴿إِنَّ الْعَـقِبَةَ لِلْمُتَّقِينَ﴾

(Surely, the (good) end is for those who have Taqwa.)(11:49),

﴿إِنَّا لَنَنصُرُ رُسُلَنَا وَالَّذِينَ ءَامَنُواْ فِى الْحَيَوةِ الدُّنْيَا وَيَوْمَ يَقُومُ الاٌّشْهَـدُ - يَوْمَ لاَ يَنفَعُ الظَّـلِمِينَ مَعْذِرَتُهُمْ وَلَهُمُ الْلَّعْنَةُ وَلَهُمْ سُوءُ الدَّارِ ﴾

(Verily, We will indeed make victorious Our Messengers and those who believe in the life of this world and on the Day when the witnesses will stand forth, the Day when their excuses will be of no profit to the wrongdoers. Theirs will be the curse, and theirs will be the evil abode.)(40:51-52) Allah said here,

﴿كَتَبَ اللَّهُ لاّغْلِبَنَّ أَنَاْ وَرُسُلِى إِنَّ اللَّهَ قَوِىٌّ عَزِيزٌ ﴾
(Allah has decreed: "Verily, I and My Messengers shall be the victorious.'' Verily, Allah is All-Powerful, Almighty.) meaning, the Almighty, All-Powerful has decreed that He shall prevail over His enemies. Indeed, this is the final judgement and a matter ordained; the final triumph and victory are for the believers in this life and the Hereafter