“which he [God] promised beforehand through his prophets in the holy Scriptures, concerning his Son, who was descended from David according to the flesh”
(Romans 1:2–3 ESV)
“But in Jeremiah 22:30, in the chapter just before the one prophesying “a righteous Branch” that would arise in David’s line, a harsh curse is pronounced on a king named Jehoiachin, the last of the actual reigning kings descended from King Solomon: “Record this man as if childless, a man who will not prosper in his lifetime: for none of his offspring will prosper, none will sit on the throne of David or rule anymore in Judah.” Because of God’s curse, no king descended in that line could reign legitimately.
There was another strong line of descent, however. King Solomon had an older brother, Nathan, who would have been king if God had not given the throne to Solomon. Nathan had also produced descendants, but any descendant of this line who claimed inheritance of the promises made to King David would have been challenged immediately be descendants in the line that had actually reigned. How could such a dilemma be solved? There was a lack of reigning kings in one line and a curse on the other.
The way God solved the issue was so simple that it confounds the wisest skeptics. The line of Solomon ran on through the centuries until it eventually produced Joseph, who was betrothed to the Virgin Mary and eventually became her husband, though not until after she had conceived and given birth to the Lord Jesus Christ. Jesus was not descended from Joseph; otherwise he would have inherited the curse on that line. But when Joseph took Mary under his protection and thus became the adoptive father of her divine child, he passed the right of royalty to him. And since Jesus was also descended from Mary – who, as it turns out, was a descendant of David through the line of Nathan – Jesus combined the claims of the two lines in his unique personhood and thereby eliminated the possibility of there ever being any other legitimate claimant to the throne. In other words, if Jesus is not the Messiah who has descended from David according to the Old Testament prophecies, there will never be a Messiah. For Jesus had no human children, and each of his brothers (who are the only other possibilities through whom another Messiah might descend) had the curse on him and would have passed it on to his children.”
–An Expositional Commentary on Romans by James Montgomery Boice, pages 41-42.