The coming of the Messiah and the subsequent redemption of Israel is a basic belief of Judaism.
G-d will bring the redemption in his own time. If all Israel were to return to G-d through Teshuva, the Messiah would appear and the final redemption would be ushered in immediately. Otherwise, the redemption will not occur until the final time decreed by G-d. This is the meaning of the verse, "I, G-d, will accelerate it in its due time" (Isaiah 60:22). That is, if Israel is worthy, G-d will hasten the redemption; if they are not, it will still come, but only in its due time.
Thus, we find two contradictory concepts regarding the advent of the Messianic Era in the Bible. There are many passages which indicate that the Messianic Era will be ushered in with miracles, such as, "In visions of the night, I beheld the likes of a human being who came with the clouds of heaven…and he was given…an everlasting dominion which will never pass away" (Daniel 7:13-14).
On the other hand, numerous passages in the Prophets indicate that the Messiah will come in a more natural manner, such as "Behold, your king comes to you…humble and riding upon a donkey" (Zechariah 9:9) Here again, we are taught that there are two basic ways in which the Messianic Era can commence. If Israel is worthy, it will indeed be accompanied by heavenly miracles. If not, the Messianic Era will arrive through a natural unfolding of historical events. In either case, G-d Himself will guide the forces of history to eventually bring about the Messianic Era.
The Messiah will be a direct descendant of King David, from the tribe of Judah. He is therefore known as Mashiach ben David or Messiah the son of David. Kabbalah teaches that there will be another Messiah, from the tribe of Ephraim, the son of Joseph, who will precede Mashiach ben David. He is therefore known as Mashiach ben Yosef or Mashiach ben Ephraim.
The Zohar tells us that Israel 's enemies will only succumb to a descendant of Joseph. Thus, Mashiach ben Yosef will be the one who will lead Israel to a victory in the war of God and Magog. This is the meaning of the verse, "The house of Jacob will be a fire, and the house of Joseph a flame, and the house of Esau stubble. They will set them ablaze, and consume them; there will be no survivor of the house of Esau, for God has spoken" (Ovadiah 1:18)
Concerning the relationship between the two Messiahs – the initial Messiah, Mashiach ben Yosef, and the final Messiah, Mashiach ben David – the prophet declared, "Ephraim's envy will depart and Judah 's adversaries will be cut off. Ephraim will not envy Judah and Judah will not harass Ephraim" (Isaiah 11:13). That is, each Messiah will perform his appointed task, without jealousy. It is likewise written, "Son of man, take a stick and write upon it, 'For Judah, and the children of Israel , his companions.' Then take another stick, and write upon it, "For Joseph, the stick of Ephraim, and all the house of Israel , his companions." Join them together into one stick, so that they are one in your hand." (Ezekiel 37:16-17).
According to Kabalah, the initial Messiah will fight and be killed in the war of Gog and Magog. He will be mourned by all Israel , as it is written, "They shall look to Me because they have thrust him through, and they shall mourn for him, as one mourns his first born son" (Zechariah 12:10).
Before the appearance of the final Messiah, a prophet will arise to announce his coming and to draw the Jewish people back to G-d. This prophet will be Elijah. It is thus written, "Behold, I will send you Elijah the prophet before the coming of the great and awesome day of G-d." (Malachi 3:23). His primary task will be to bring peace to the world by leading all people back to G-d. The prophecy thus concludes, "He will turn the heart of the fathers to their children and the hearts of the children to their fathers so that I (G-d) should not strike the world with destruction" (ibid 3:24)
May Mashiach come speedily in our days.