(From Rambam1 )

“A King will arise:” Apparently, this King — Moshiach — will not be appointed by a Beth Din of 70 men and a Prophet, as is required for every King.2 This is seen in the Rambam’s historical proof3 that Rabbi Akiva referred to Bar Kochba as the King Moshiach — although there was no Prophet at that time.

“He will delve into Torah:”

Until it becomes his Torah, part and parcel of himself, as the Talmud states:4 First it is called G‑d’s Torah; then, when one delves into it, it is called his — the person’s Torah, as is written:5 “Whose delight is in the Torah of G‑d, and in His Torah does he delve day and night.”

Said Rava: First one should study Torah, and then he should delve into it.

Rashi explains that one should first study from his Rav until the subject is fully clear to him. Then he should delve deeply into it, to make comparisons, to raise questions and provide answers. This is the height of Torah study.

Pirkei D’Rav Eliezer6 notes that “the voice of Jacob” nullifies the harmful effects of Esau’s hands”;7 this voice of Jacob is expressed through “delving into Torah.”

“Just like King David his Father:”

This means that Torah study should be in a manner of accepting the yoke of Torah. And the observance of mitzvos should be preceded by the yoke of teshuvah, as in the familiar phrase: Teshuvah and good deeds.” This pattern was established by King David, as the Talmud comments on the verse in Nach:8

“These are the words of David, and these are the words of the man who was raised on high” (al) — These are the words of David who established ula, “the yoke of teshuvah” which uplifts the person to the greatest heights and closeness to G‑d.

Midrash Shmuel notes: “David accepted and carried the yoke of Torah together with the yoke of Kingship.”

“Moshiach will study Torah according to the Written Torah and the Oral Torah:” Why does Rambam add these words? This follows the end of Halachah 3 (in uncensored editions): “Whoever adds to or deletes from Torah, or interprets Torah incorrectly, taking mitzvos out of their literal context, he is certainly an evildoer and a heretic (this negates any belief in Yeshu as the Messiah).

“He will coerce all Jews:” This is linked with the rectification for the churban (destruction of the Holy Temple), as the Talmud relates9 :

Jerusalem was destroyed because the people did not admonish each other. Rather, the Jews in that generation stuck their heads in the ground and didn’t admonish those who sinned and deviated from a Torah life.

“To go in its path and to strengthen its weakness:” To go in its path — is directed to those who didn’t sin — i.e. the tzaddikim. And to strengthen its weakness — to those who transgressed and repented — i.e. baalei teshuvah.

“And he will build the Beis Hamikdash:” As the Midrashnotes,10 Moshiach will build the Beis Hamikdash:

“When the King Moshiach who is in the north will arise, he will come and build the Beis Hamikdash which is situated in the south”11 (i.e. the south part of the Temple Mount).

Rashi and Tosphos, however, maintain that the Beis Hamikdash will come down from Heaven, as they state:12

The Third Beis Hamikdash which we eagerly await is already built and furnished; it will be revealed and come from Heaven, as is written,13 “Your Sanctuary, O G‑d, which Your hands have established.”

This is also underscored in Tanchuma:14 G‑d swore that He himself will rebuild it, as is written,15 “G‑d builds Jerusalem.”

“The Beis-Hamikdash in its place:” Although, in general, only the Altar can never be changed from its place,16 yet, the whole Temple of the future must be in its original place, as specified in Ezekiel. Also, this will determine who Moshiach really is, by showing the precise site of the Beis Hamikdash.

“And he will bring the ingathering of Jews:” At the end. As Rashi states:17 First “G‑d will build Jerusalem” — then “He will gather the ingathering of all Jews.”