How is Jesus in the lineage of David?

How is Jesus in the lineage of David when it is Joseph who of this lineage and not Mary?

The following links should assist you in better understanding the Catholic Church’s teaching on Jesus’ geneology. If you have any further questions or concerns that are not answered by these links, please contact Catholic Answers directly.

**Recommended Reading:
[LIST]
*]If Joseph isn’t Jesus’ father, how can Jesus be the Son of David?
*]**Do we know for certain the Blessed Mother’s lineage? **
*]Do we know Jesus’ genealogy?
[/LIST]
**

DISCLAIMER: The views and opinions expressed in these forums do not necessarily reflect those of Catholic Answers. For official apologetics resources please visit www.catholic.com.