What is the difference between a Messiah and a prophet?
There have been very many prophets, but not all of them were called Messiah. What marks the Messiah is that he teaches the highest sacrifice and gives up the sword, even though defending himself would be permitted.
Over the course of history God has sent a great many prophets. Only a few of them bear the title Messiah. The difference is not whether someone comes from God, since that is true of all of them. It lies in the particular way a Messiah carries out his task.
God allowed many prophets to defend themselves when the sword was raised against them. The verse above grants this permission to those who are attacked and wronged. That is just, and no one can blame them for it.
The Messiah takes a different path. He teaches the highest sacrifice in the name of faith. Even when he and his followers are beaten for God’s sake, they respond with patience. Jesus (as) taught that whoever is struck on one cheek should offer the other as well. Through such sacrifice more hearts are won than by the sword. The Messiah would have the right to defend himself, and still he refrains. That is the essence of being the Messiah.
This is why the hadith above says that the coming son of Mary would put an end to war. The awaited Messiah of the last days was not to spread faith by force, but by patience and convincing reasons. So the difference shows itself in practice. A prophet may defend himself with arms, while a Messiah freely chooses the path of sacrifice.