The Rambam provides a detailed halakhic account of the messianic era: the king who will arise from the House of David, the ingathering of exiles, the rebuilding of the Temple, and the nature of that era as continuous with this world but free of oppression and strife.
הַמֶּלֶךְ הַמָּשִׁיחַ עָתִיד לַעֲמֹד וּלְהַחְזִיר מַלכוּת דָּוִד לְיָשְׁנָהּ לַמֶּמְשָׁלָה הָרִאשׁוֹנָה. וּבוֹנֶה הַמִּקְדָּשׁ וּמְקַבֵּץ נִדְחֵי יִשְׂרָאֵל. וְחוֹזְרִין כָּל הַמִּשְׁפָּטִים בְּיָמָיו כְּשֶׁהָיוּ מִקֹּדֶם. מַקְרִיבִין קָרְבָּנוֹת. וְעוֹשִׂין שְׁמִטִּין וְיוֹבְלוֹת כְּכָל מִצְוָתָן הָאֲמוּרָה בַּתּוֹרָה. וְכָל מִי שֶׁאֵינוֹ מַאֲמִין בּוֹ. אוֹ מִי שֶׁאֵינוֹ מְחַכֶּה לְבִיאָתוֹ. לֹא בִּשְׁאָר נְבִיאִים בִּלְבַד הוּא כּוֹפֵר. אֶלָּא בַּתּוֹרָה וּבְמשֶׁה רַבֵּנוּ. שֶׁהֲרֵי הַתּוֹרָה הֵעִידָה עָלָיו שֶׁנֶּאֱמַר (דברים ל, ג) "וְשָׁב ה' אֱלֹהֶיךָ אֶת שְׁבוּתְךָ וְרִחֲמֶךָ וְשָׁב וְקִבֶּצְךָ" וְגוֹ' (דברים ל, ד) "אִם יִהְיֶה נִדַּחֲךָ בִּקְצֵה הַשָּׁמָיִם" וְגוֹ' (דברים ל, ה) "וֶהֱבִיאֲךָ ה'". וְאֵלּוּ הַדְּבָרִים הַמְפֹרָשִׁים בַּתּוֹרָה הֵם כּוֹלְלִים כָּל הַדְּבָרִים שֶׁנֶּאֶמְרוּ עַל יְדֵי כָּל הַנְּבִיאִים. אַף בְּפָרָשַׁת בִּלְעָם נֶאֱמַר וְשָׁם נִבֵּא בִּשְׁנֵי הַמְּשִׁיחִים. בַּמָּשִׁיחַ הָרִאשׁוֹן שֶׁהוּא דָּוִד שֶׁהוֹשִׁיעַ אֶת יִשְׂרָאֵל מִיַּד צָרֵיהֶם. וּבַמָּשִׁיחַ הָאַחֲרוֹן שֶׁעוֹמֵד מִבָּנָיו שֶׁמּוֹשִׁיעַ אֶת יִשְׂרָאֵל [בָּאַחֲרוֹנָה]. וְשָׁם הוּא אוֹמֵר (במדבר כד, יז) "אֶרְאֶנּוּ וְלֹא עַתָּה" זֶה דָּוִד. (במדבר כד, יז) "אֲשׁוּרֶנּוּ וְלֹא קָרוֹב" זֶה מֶלֶךְ הַמָּשִׁיחַ. (במדבר כד, יז) "דָּרַךְ כּוֹכָב מִיַּעֲקֹב" זֶה דָּוִד. (במדבר כד, יז) "וְקָם שֵׁבֶט מִיִּשְׂרָאֵל" זֶה מֶלֶךְ הַמָּשִׁיחַ. (במדבר כד, יז) "וּמָחַץ פַּאֲתֵי מוֹאָב" זֶה דָּוִד. וְכֵן הוּא אוֹמֵר (שמואל ב ח, ב) "וַיַּךְ אֶת מוֹאָב וַיְמַדְּדֵם בַּחֶבֶל" (במדבר כד, יז) "וְקַרְקַר כָּל בְּנֵי שֵׁת" זֶה הַמֶּלֶךְ הַמָּשִׁיחַ שֶׁנֶּאֱמַר בּוֹ (זכריה ט, י) "וּמָשְׁלוֹ מִיָּם עַד יָם". (במדבר כד, יח) "וְהָיָה אֱדוֹם יְרֵשָׁה" זֶה דָּוִד. שֶׁנֶּאֱמַר (שמואל ב ח, יד) "וַתְּהִי אֱדוֹם לְדָוִד לַעֲבָדִים" וְגוֹ'. (במדבר כד, יח) "וְהָיָה יְרֵשָׁה" וְגוֹ' זֶה הַמֶּלֶךְ הַמָּשִׁיחַ שֶׁנֶּאֱמַר (עובדיה א, כא) "וְעָלוּ מוֹשִׁעִים בְּהַר צִיּוֹן" וְגוֹ': אַל יַעֲלֶה עַל הַלֵּב שֶׁבִּימוֹת הַמָּשִׁיחַ יִבָּטֵל דָּבָר מִמִּנְהָגוֹ שֶׁל עוֹלָם. אוֹ יִהְיֶה שָׁם חִדּוּשׁ בְּמַעֲשֵׂה בְּרֵאשִׁית. אֶלָּא עוֹלָם כְּמִנְהָגוֹ נוֹהֵג. וְזֶה שֶׁנֶּאֱמַר בִּישַׁעְיָה (ישעיה יא, ו) "וְגָר זְאֵב עִם כֶּבֶשׂ וְנָמֵר עִם גְּדִי יִרְבָּץ" מָשָׁל וְחִידָה. עִנְיַן הַדָּבָר שֶׁיִּהְיוּ יִשְׂרָאֵל יוֹשְׁבִין לָבֶטַח עִם רִשְׁעֵי עַכּוּ"ם הַמְשׁוּלִים כִּזְאֵב וְנָמֵר. שֶׁנֶּאֱמַר (ירמיה ה, ו) "זְאֵב עֲרָבוֹת יְשָׁדְדֵם וְנָמֵר שֹׁקֵד עַל עָרֵיהֶם". וְיַחְזְרוּ כֻּלָּם לְדַת הָאֱמֶת. וְלֹא יִגְזְלוּ וְלֹא יַשְׁחִיתוּ. אֶלָּא יֹאכְלוּ דָּבָר הַמֻּתָּר בְּנַחַת עִם יִשְׂרָאֵל. שֶׁנֶּאֱמַר (ישעיה יא, ז) "וְאַרְיֵה כַּבָּקָר יֹאכַל תֶּבֶן". וְכֵן כָּל כַּיּוֹצֵא בְּאֵלּוּ הַדְּבָרִים בְּעִנְיַן הַמָּשִׁיחַ הֵם מְשָׁלִים. וּבִימוֹת הַמֶּלֶךְ הַמָּשִׁיחַ יִוָּדַע לַכּל לְאֵי זֶה דָּבָר הָיָה מָשָׁל. וּמָה עִנְיָן רָמְזוּ בָּהֶן: אָמְרוּ חֲכָמִים אֵין בֵּין הָעוֹלָם הַזֶּה לִימוֹת הַמָּשִׁיחַ אֶלָּא שִׁעְבּוּד מַלְכֻיּוֹת בִּלְבַד. יֵרָאֶה מִפְּשׁוּטָן שֶׁל דִּבְרֵי הַנְּבִיאִים. שֶׁבִּתְחִלַּת יְמוֹת הַמָּשִׁיחַ תִּהְיֶה מִלְחֶמֶת גּוֹג וּמָגוֹג. וְשֶׁקֹּדֶם מִלְחֶמֶת גּוֹג וּמָגוֹג יַעֲמֹד נָבִיא לְיַשֵּׁר יִשְׂרָאֵל וּלְהָכִין לִבָּם. שֶׁנֶּאֱמַר (מלאכי ג, כג) "הִנֵּה אָנֹכִי שׁלֵחַ לָכֶם אֵת אֵלִיָּה" וְגוֹ'. וְאֵינוֹ בָּא לֹא לְטַמֵּא הַטָּהוֹר. וְלֹא לְטַהֵר הַטָּמֵא. וְלֹא לִפְסל אֲנָשִׁים שֶׁהֵם בְּחֶזְקַת כַּשְׁרוּת. וְלֹא לְהַכְשִׁיר מִי שֶׁהֻחְזְקוּ פְּסוּלִין. אֶלָּא לָשׂוּם שָׁלוֹם בָּעוֹלָם. שֶׁנֶּאֱמַר (מלאכי ג, כד) "וְהֵשִׁיב לֵב אָבוֹת עַל בָּנִים". וְיֵשׁ מִן הַחֲכָמִים שֶׁאוֹמְרִים שֶׁקֹּדֶם בִּיאַת הַמָּשִׁיחַ יָבוֹא אֵלִיָּהוּ. וְכָל אֵלּוּ הַדְּבָרִים וְכַיּוֹצֵא בָּהֶן לֹא יֵדַע אָדָם אֵיךְ יִהְיוּ עַד שֶׁיִּהְיוּ. שֶׁדְּבָרִים סְתוּמִין הֵן אֵצֶל הַנְּבִיאִים. גַּם הַחֲכָמִים אֵין לָהֶם קַבָּלָה בִּדְבָרִים אֵלּוּ. אֶלָּא לְפִי הֶכְרֵעַ הַפְּסוּקִים. וּלְפִיכָךְ יֵשׁ לָהֶם מַחְלֹקֶת בִּדְבָרִים אֵלּוּ. וְעַל כָּל פָּנִים אֵין סִדּוּר הֲוָיַת דְּבָרִים אֵלּוּ וְלֹא דִּקְדּוּקֵיהֶן עִקָּר בַּדָּת. וּלְעוֹלָם לֹא יִתְעַסֵּק אָדָם בְּדִבְרֵי הַהַגָּדוֹת. וְלֹא יַאֲרִיךְ בַּמִּדְרָשׁוֹת הָאֲמוּרִים בְּעִנְיָנִים אֵלּוּ וְכַיּוֹצֵא בָּהֶן. וְלֹא יְשִׂימֵם עִקָּר. שֶׁאֵין מְבִיאִין לֹא לִידֵי יִרְאָה וְלֹא לִידֵי אַהֲבָה. וְכֵן לֹא יְחַשֵּׁב הַקִּצִּין. אָמְרוּ חֲכָמִים תִּפַּח רוּחָם שֶׁל מְחַשְּׁבֵי הַקִּצִּים. אֶלָּא יְחַכֶּה וְיַאֲמִין בִּכְלַל הַדָּבָר כְּמוֹ שֶׁבֵּאַרְנוּ:
In the future, the Messianic king will arise and renew the Davidic dynasty, restoring it to its initial sovereignty. He will build the Temple and gather the dispersed of Israel. Then, in his days, the observance of all the statutes will return to their previous state. We will offer sacrifices, observe the Sabbatical and Jubilee years according to all their particulars as described by the Torah. Anyone who does not believe in him or does not await his coming, denies not only the statements of the other prophets, but those of the Torah and Moses, our teacher. The Torah testified to his coming, as Deuteronomy 30:3-5 states: God will bring back your captivity and have mercy upon you. He will again gather you from among the nations... Even if your Diaspora is at the ends of the heavens, God will gather you up from there... and bring you to the land.... These explicit words of the Torah include all the statements made by all the prophets. Reference to Mashiach is also made in the portion of Bilaam who prophesies about two anointed kings: the first anointed king, David, who saved Israel from her oppressors; and the final anointed king who will arise from his descendants and save Israel in the end of days. That passage Numbers 24:17-18 relates: 'I see it, but not now' - This refers to David; 'I perceive it, but not in the near future;" - This refers to the Messianic king; 'A star shall go forth from Jacob' - This refers to David; 'and a staff shall arise in Israel' - This refers to the Messianic king; 'crushing all of Moab's princes' - This refers to David as II Samuel 8:2 relates: 'He smote Moab and measured them with a line;' 'decimating all of Seth's descendants' - This refers to the Messianic king about whom Zechariah 9:10 prophesies: 'He will rule from sea to sea.' 'Edom will be demolished' - This refers to David as II Samuel 8:6 states 'Edom became the servants of David;' 'Seir will be destroyed' - this refers to the Messianic king as Ovadiah 1:21 prophesies: 'Saviors will ascend Mount Zion to judge the mountain of Esau....' Do not presume that in the Messianic age any facet of the world's nature will change or there will be innovations in the work of creation. Rather, the world will continue according to its pattern. Although Isaiah 11:6 states: 'The wolf will dwell with the lamb, the leopard will lie down with the young goat,' these words are a metaphor and a parable. The interpretation of the prophecy is as follows: Israel will dwell securely together with the wicked gentiles who are likened to a wolf and a leopard, as in the prophecy Jeremiah 5:6: 'A wolf from the wilderness shall spoil them and a leopard will stalk their cities.' They will all return to the true faith and no longer steal or destroy. Rather, they will eat permitted food at peace with Israel as Isaiah 11:7 states: 'The lion will eat straw like an ox.' Similarly, other Messianic prophecies of this nature are metaphors. In the Messianic era, everyone will realize which matters were implied by these metaphors and which allusions they contained. Our Sages taught: "There will be no difference between the current age and the Messianic era except the emancipation from our subjugation to the gentile kingdoms." The simple interpretation of the prophets' words appear to imply that the war of Gog and Magog will take place at the beginning of the Messianic age. Before the war of Gog and Magog, a prophet will arise to inspire Israel to be upright and prepare their hearts, as Malachi 3:22 states: 'Behold, I am sending you Elijah.' He will not come to declare the pure, impure, or to declare the impure, pure. He will not dispute the lineage of those presumed to be of proper pedigree, nor will he validate the pedigree of those whose lineage is presumed blemished. Rather, he will establish peace within the world as ibid. 3:24 continues: 'He will turn the hearts of the fathers to the children." There are some Sages who say that Elijah's coming will precede the coming of the Mashiach. All these and similar matters cannot be definitely known by man until they occur for these matters are undefined in the prophets' words and even the wise men have no established tradition regarding these matters except their own interpretation of the verses. Therefore, there is a controversy among them regarding these matters. Regardless of the debate concerning these questions, neither the order of the occurrence of these events or their precise detail are among the fundamental principles of the faith. A person should not occupy himself with the Aggadot and homiletics concerning these and similar matters, nor should he consider them as essentials, for study of them will neither bring fear or love of God. Similarly, one should not try to determine the appointed time for Mashiach's coming. Our Sages declared: 'May the spirits of those who attempt to determine the time of Mashiach's coming expire!' Rather, one should await and believe in the general conception of the matter as explained.