Protoevangelio de Santiago
The Gospel of James (a 2nd century apocryphal gospel also called the "Protoevangelium of James" or the "Infancy Gospel of James"), says that Mary was betrothed to Joseph and that he already had children. In this case, James was one of Joseph's children from his previous marriage and, therefore, Jesus' stepbrother.