Rasulu Allah (saws) did not flee, he stood fast in his place and fought bravely. He called the Muslims to join him. When the Muslims heard Rasulu Allah (saws), they felt ashamed of what they did and came back and won a clear victory.
This battle was a great lesson for Muslims that they should not be proud but they always seek the help of Allah.
After this battle Rasulu Allah (saws) went back to Madinah.