In Surat Qaf, Ayah 29, and Allah said:
مَا يُبَدَّلُ الْقَوْلُ لَدَيَّ وَمَا أَنَا بِظَلامٍ لِّلْعَبِيدِ
My Will does not change. Ibn Mardawayh narrated from the Prophet that Prophet Muhammad asked his Lord for four (4) matters:
1. That his nation would not be destroyed by famine;
2. That his nation would not be completely destroyed by any enemy;
3. That his nation would not be completely destroyed by a torture similar to the torture which destroyed the previous nations; and
4. That the people of his nation would not fight one against the other. The Prophet said that Allah granted him the first three matters but did not grant him the fourth one.
So, although it was Prophet Muhammad, the best of the creations, who made that supplication, Allah did not grant him all what he asked. This is because Allah willed in eternity there would be fighting between the Muslims in the different eras–and the Will of Allah does not change.
That Allah’s Will does not change was more specifically clarified in Imam Muslim’s narration of this hadith in his Sahih. Imam Muslim narrated that after the Prophet asked Allah for matters, Allah revealed to him
إني إذا قضيت أمرا فإنه لا يرد
O Muhammad, if I willed for something to happen, My Will would not change.
Imam Sedin Agic