In reading the commentary Malbim on Jeremiah 23:6, it seems to be saying that Moshiach may deliver Israel by his own righteousness and merit. Does this mean that his righteousness will be considered on our behalf, so that we who have not merited deliverance will still receive it?
"Behold, the days come, saith the LORD, that I will raise unto David a righteous shoot, and he shall reign as king and prosper, and shall execute justice and righteousness in the land. In his days Judah shall be saved, and Israel shall dwell safely; and this is his name whereby he shall be called, The LORD is our righteousness."
-Jeremiah 23:5-6 JPS 1917
"his name that he shall be called He will then be called ‘the Lord is our righteousness’ because our righteousness is the Lord, as it says “…O God of my righteousness…” (Tehillim 4:2) meaning that my righteousness will come from God – just as He exists so too Israel will be righteous and saved by God. This prophecy is repeated further on in 33:15, with some changes. It says ‘I will cause to grow for David a plant of righteousness’ but does not mention ‘and he shall reign a king and prosper.’ There it is written ‘In those days, Judah shall be saved, and Jerusalem shall dwell securely and this is the name that He shall call it, the Lord is our righteousness.’ This is because there are two manners of redemption. If it comes through our merit ‘I will hurry it,’ if it is not through our merit ‘in its time’ (see Isaiah 60:22 and gem. Sanhedrin 98a). It further says there in the gemara: if it is through our merit ‘and behold with the clouds (ananei) of the heaven, one like a man was coming’ (Daniel 7:13) and if not ‘humble (ani), and riding a donkey.’ (Zechariah 9:9) Here in chapter 23 the prophet is speaking about redemption that comes through merit, which is why it says ‘I will set up of David a righteous shoot,’ meaning that he will be righteous through his merit. In chapter 33 the prophet is speaking about redemption which comes not through our merit, which is why it says ‘In those days and in that time I will cause to grow for David a plant of righteousness,’ because the supernal righteousness will not look at the acts of righteousness and merit, but rather will act out of generous kindness and through an arousal from above, as I explained in Yeshayahu 29. Therefore it does not say ‘I will set up of David,’ but rather ‘I will cause to grow for David,’ because it will be a new growth. This is not the case for redemption brought on through merit, there it says ‘I will set up’ because the growth will exist already through the merit of his actions and God will simply lift it up from its fallen state. Further in chapter 33 the prophet adds ‘In those days and in that time’ because if it is not through merit we will have to wait until the appointed time. This is not the case here in chapter 23, it does not say ‘in that time’ because ‘I will hurry it.’ So too it does not say in chapter 33 ‘and he shall reign a king and prosper’ because if it is not through merit then he will not reign right away, but rather he will be ‘humble, and riding a donkey.’ Further, it doesn’t say there ‘and Israel shall dwell safely’ because if we do not merit the tribes will not be gathered in right away, rather only Yehudah and Jerusalem will be saved. The ingathering will be delayed until Jerusalem is rebuilt first. It does not say in chapter 33 ‘and this is its name’ in reference to Jerusalem because it will not have this name already due to our lack of merit, ‘this is the name that He shall call it’ Jerusalem from now forward. But here in chapter 23 where it describes redemption through our merit it says ‘and this is his name’ because he will have already acquired this name through his merit."
https://www.sefaria.org/Jeremiah.23.6?lang=bi&with=Commentary