How is that possible? The lineage was and still is traced through the father. So, if Joseph is not the father, how can Jesus claim that he's from the House of David and fulfilled the prophecy?
Gospel of Mattai 1
1. The book of the genealogy of Yeshua, the Messiah, the son of David, the son of Awraham.
(Read the rest of Matthew chapter 1 for the entire genealogy)
It's a fulfillment of the following prophecy -
Jeremiah 23:5-6
5. Behold, days are coming, says the Lord, when I will set up of David a righteous shoot, and he shall reign a king and prosper, and he shall perform judgment and righteousness in the land. ה. 6. In his days, Judah shall be saved and Israel shall dwell safely, and this is his name that he shall be called, The Lord is our righteousness.
Isaiah 7
13. And he said, "Listen now, O House of David, is it little for you to weary men, that you weary my God as well?
14. Therefore, the Lord, of His own, shall give you a sign; behold, the young woman is with child, and she shall bear a son, and she shall call his name Immanuel.
1 Chronicles 17
11. And it will come to pass when your days are finished to go with your forefathers, then I shall raise up your seed after you, who will be of your sons, and I shall establish his kingdom.
12. He will build Me a house, and I shall establish his throne forever.
13. I shall be to him as a father, and he will be to Me as a son, and I shall not remove My loving-kindness from him as I removed [it] from he who was before you.
14. And I shall station him in My house and in My kingdom forever, and his throne shall be established forever."
15. According to all these words, and according to all this vision, so did Nathan speak to David.
Yeshua (Jesus) is both from the lineage of David (Yehudah) and Aaron (Levite).
Mary was a daughter of Aaron, confirmed because her cousin Elizabeth was a Levite. Mary's ancestors also served in the Temple as Kohanim (Priests).
Joseph who Mary Married, was a descendent of David!
Hence the Torah law, in
Genesis 2:24
24. Therefore, a man shall leave his father and his mother, and cleave to his wife, and they shall become one flesh.
The 'one flesh' covenant relates back to Adam and Havah (Eve) when Havah was created from taking Adams rib.
Genesis 1
26. And God said, "Let us make man in our image, after our likeness, and
they shall rule over the fish of the sea and over the fowl of the heaven and over the animals and over all the earth and over all the creeping things that creep upon the earth." כו. וַיֹּאמֶר אֱ־לֹהִים נַעֲשֶׂה אָדָם בְּצַלְמֵנוּ כִּדְמוּתֵנוּ וְיִרְדּוּ בִדְגַת הַיָּם וּבְעוֹף הַשָּׁמַיִם וּבַבְּהֵמָה וּבְכָל הָאָרֶץ וּבְכָל הָרֶמֶשׂ הָרֹמֵשׂ עַל הָאָרֶץ:
27. And God created man in His image; in the image of God
He created him; male and female
He created them. כז. וַיִּבְרָא אֱ־לֹהִים אֶת הָאָדָם בְּצַלְמוֹ בְּצֶלֶם אֱ־לֹהִים בָּרָא אֹתוֹ זָכָר וּנְקֵבָה בָּרָא אֹתָם:
28. And God blessed
them, and God said to
them, "Be fruitful and multiply and fill the earth and subdue it, and rule over the fish of the sea and over the fowl of the sky and over all the beasts that tread upon the earth. " כח. וַיְבָרֶךְ אֹתָם אֱ־לֹהִים וַיֹּאמֶר לָהֶם אֱ־לֹהִים פְּרוּ וּרְבוּ וּמִלְאוּ אֶת הָאָרֶץ וְכִבְשֻׁהָ וּרְדוּ בִּדְגַת הַיָּם וּבְעוֹף הַשָּׁמַיִם וּבְכָל חַיָּה הָרֹמֶשֶׂת עַל הָאָרֶץ:
Genesis 2
7. And the Lord God formed man of dust from the ground, and He breathed into his nostrils the soul of life, and man became a living soul. ז. וַיִּיצֶר יְ־הֹוָ־ה אֱ־לֹהִים אֶת הָאָדָם עָפָר מִן הָאֲדָמָה וַיִּפַּח בְּאַפָּיו נִשְׁמַת חַיִּים וַיְהִי הָאָדָם לְנֶפֶשׁ חַיָּה:
8. And the Lord God planted a garden in Eden from the east, and He placed there the man whom He had formed. ח. וַיִּטַּע יְ־הֹוָ־ה אֱ־לֹהִים גַּן בְּעֵדֶן מִקֶּדֶם וַיָּשֶׂם שָׁם אֶת הָאָדָם אֲשֶׁר יָצָר:
Genesis 2
15. Now the Lord God took the man, and He placed him in the Garden of Eden to work it and to guard it. טו. וַיִּקַּח יְ־הֹוָ־ה אֱ־לֹהִים אֶת הָאָדָם וַיַּנִּחֵהוּ בְגַן עֵדֶן לְעָבְדָהּ וּלְשָׁמְרָהּ:
16. And the Lord God commanded man, saying, "Of every tree of the garden you may freely eat. טז. וַיְצַו יְ־הֹוָ־ה אֱ־לֹהִים עַל הָאָדָם לֵאמֹר מִכֹּל עֵץ הַגָּן אָכֹל תֹּאכֵל:
17. But of the Tree of Knowledge of good and evil you shall not eat of it, for on the day that you eat thereof, you shall surely die." יז. וּמֵעֵץ הַדַּעַת טוֹב וָרָע לֹא תֹאכַל מִמֶּנּוּ כִּי בְּיוֹם אֲכָלְךָ מִמֶּנּוּ מוֹת תָּמוּת:
18. And the Lord God said, "It is not good that man is alone; I shall make him a helpmate opposite him." יח. וַיֹּאמֶר יְ־הֹוָ־ה אֱ־לֹהִים לֹא טוֹב הֱיוֹת הָאָדָם לְבַדּוֹ אֶעֱשֶׂה לּוֹ עֵזֶר כְּנֶגְדּוֹ:
19. And the Lord God formed from the earth every beast of the field and every fowl of the heavens, and He brought [it] to man to see what he would call it, and whatever the man called each living thing, that was its name. יט. וַיִּצֶר יְ־הֹוָ־ה אֱ־לֹהִים מִן הָאֲדָמָה כָּל חַיַּת הַשָּׂדֶה וְאֵת כָּל עוֹף הַשָּׁמַיִם וַיָּבֵא אֶל הָאָדָם לִרְאוֹת מַה יִּקְרָא לוֹ וְכֹל אֲשֶׁר יִקְרָא לוֹ הָאָדָם נֶפֶשׁ חַיָּה הוּא שְׁמוֹ:
20. And man named all the cattle and the fowl of the heavens and all the beasts of the field, but for man, he did not find a helpmate opposite him. כ. וַיִּקְרָא הָאָדָם שֵׁמוֹת לְכָל הַבְּהֵמָה וּלְעוֹף הַשָּׁמַיִם וּלְכֹל חַיַּת הַשָּׂדֶה וּלְאָדָם לֹא מָצָא עֵזֶר כְּנֶגְדּוֹ:
21. And the Lord God caused a deep sleep to fall upon man, and he slept, and He took one of his sides, and He closed the flesh in its place. כא. וַיַּפֵּל יְ־הֹוָ־ה אֱ־לֹהִים תַּרְדֵּמָה עַל הָאָדָם וַיִּישָׁן וַיִּקַּח אַחַת מִצַּלְעֹתָיו וַיִּסְגֹּר בָּשָׂר תַּחְתֶּנָּה:
22. And the Lord God built the side that He had taken from man into a woman, and He brought her to man. כב. וַיִּבֶן יְ־הֹוָ־ה אֱ־לֹהִים אֶת הַצֵּלָע אֲשֶׁר לָקַח מִן הָאָדָם לְאִשָּׁה וַיְבִאֶהָ אֶל הָאָדָם:
23. And man said, "This time, it is bone of my bones and flesh of my flesh. This one shall be called ishah (woman) because this one was taken from ish (man)." כג. וַיֹּאמֶר הָאָדָם זֹאת הַפַּעַם עֶצֶם מֵעֲצָמַי וּבָשָׂר מִבְּשָׂרִי לְזֹאת יִקָּרֵא אִשָּׁה כִּי מֵאִישׁ לֻקֳחָה זֹּאת:
24. Therefore, a man shall leave his father and his mother, and cleave to his wife, and they shall become one flesh. כד. עַל כֵּן יַעֲזָב אִישׁ אֶת אָבִיו וְאֶת אִמּוֹ וְדָבַק בְּאִשְׁתּוֹ וְהָיוּ לְבָשָׂר אֶחָד:
25. Now they were both naked, the man and his wife, but they were not ashamed. כה. וַיִּהְיוּ שְׁנֵיהֶם עֲרוּמִּים הָאָדָם וְאִשְׁתּוֹ וְלֹא יִתְבֹּשָׁשׁוּ:
Adam was created as 'them' before G-d took Havah from one of his ribs, they were one flesh. G-d created 'him' both 'man' and 'woman' but they were both in 'Adam' before G-d caused the deep sleep to fall on Adam to take one of his ribs and create Havah. That is how the one flesh convenant works, because a man becomes joined with woman before they were 'separated'. That is how Yeshua (Jesus) fulfilled the prophecy of coming from the House of David, because Joseph was a descendant and married Mary. I hope that helps you.
G-d bless.