Islamic Interpretation of Dreams (Ibn-i Sirin):

If a believer sees himself defeated in a dream, it means that he will wear the helmet of a warrior and win the battle against his enemy.

Ifone sees himself defeated and shows no fear in the dream, it means his death.

Ifone sees soldiers retreating into a city to take shelter therein in a dream, it means that they will ultimately win their war, even if their cause is unjust or if they represented a tyrant, though they will ultimately have to pay for their crimes.

If one sees the soldiers of ajust ruler entering a city defeated in a dream, it means that they will surely be victorious over their enemy.

(Also see Losing a fight)