Portal:Geulah & Moshiach/Selected article/3
The Third Beis HaMikdash is the Beis HaMikdash that will be built in the days of Moshiach. It will resemble the first two Temples, but with many changes; its plan was given in prophecy to the prophet Yechezkel. This Temple will be eternal.
The Gemara says that the Beis HaMikdash will be built in preparation for the kingship of David — that is, before Melech HaMoshiach comes. So the Sages expounded the verse: "Afterward the children of Israel shall return" — after they build the Beis HaMikdash — "and seek David their king."
On the other hand, it is said that the Beis HaMikdash will be built by Melech HaMoshiach, meaning that the restoration of the kingship of David precedes the building of the Temple.
In practice, the Rambam rules: "The King Moshiach will arise and restore the kingship of David to its former state, to the original sovereignty, and build the Sanctuary in its place." From the order of the Rambam's words (and even the order of his words is written with great precision), it is clear that first the kingship of David will be restored, and only afterward will the Beis HaMikdash be built.