Hi Ahsima.
The Muslim view of the Messiah is (again), mostly inline with that of the Jews, but we identify him as Jesus (as). In his first coming he was initially sent to teach the Jews about the spiritual nature of their faith, that inner piety was more important than outwardly demonstrations of it, anything otherwise was hypocrisy. However the Jews rejected him, had they accepted him then it is implied that they would have remained God’s chosen people and that Jesus (as) would take on the political role ascribed to him in the prophecies written in the Hebrew Bible, but they didn’t so this never came to be (all part of God’s plan, of course). Thus the Kingdom of God was taken from the Jews and given to another nation, and Jesus (as) was the last of the line of Jewish Prophets (this Islamic teaching, being consistent with Jesus’ words in Matthew 21:19 and 21:43).
The other nation is of course the Gentiles, and according to Islam is the Muslims as through the Prophet Muhammad (saaw). Prior to the establishment of the new Kingdom of God under him in Medina (instead of Jerusalem), we have Muhammad’s night journey to Jerusalem, where he prays upon the Temple Mount with the other Jewish Prophets behind him; and afterwards the Qibla (the direction in which Muslims pray) is changed from Jerusalem to Mecca, and the Qur’an begins to speak of the Muslims as a community of God. This is all symbolic of God’s ‘chosen people’ being taken from the Jews as their Messiah told them it would if they rejected him, and given to the Muslims.
However, the Children of Israel still have a special place in God’s plan, and the Messiah will return so they may fulfill their role. Muhammad (saaw) prophesied that in the time close to the Day of Judgement, a man shall come to power called the
Mahdi, who will set the scene for the second coming of Jesus (as) so to speak. He will restore the Caliphate, and will encounter a community of Jews living in Jerusalem, who he will convince to accept Islam and believe in Jesus (as). Upon this, he will establish the capital of the Caliphate in *Jerusalem *and not Medina, which will be abandoned. He and the Jews will also begin construction of the new/Third Temple.
All this prepares for the return of the Jewish Messiah to Jerusalem (who did say in Matthew 23:39 that the Jews would not see him again till they all believed in him). Jesus (as) will then defeat the Anti-Christ and will rule the entire world from Jerusalem (which is now once again at the heart of the Kingdom of God, instead of Medina), where he will fulfill all the prophesies related to him; he will fully reestablish the Jews as God’s people by bringing them into the Muslim community; he will complete the reconstruction of Solomon’s Temple where the Ark of Covenent will be restored; and all other religions but Islam shall be abolished.
Apologies for the rather long-winded account, hope that helps you better understand what Islam views the Messiah’s ‘function’ will be.