Answer
The Protoevangelium of James is a pseudepigraphal work also known as the Book of James (not to be confused with the New Testament Epistle of James), the Gospel of James, or the Infancy Gospel of James. It is subtitled “The Birth of Mary the Holy Mother of God, and Very Glorious Mother of Jesus Christ.” The word protoevangelium means “proto-gospel” or “precursor to the gospel,” which in this case means Mary’s story.
The Protoevangelium of James claims to have been written by James, the leader of the church in Jerusalem and the author of the New Testament Epistle of James. (Traditionally, James is designated as the half-brother of Jesus, but, according to this work, he would have to be the stepbrother of Jesus.) The Protoevangelium of James claims to give additional details about Mary’s birth and childhood as well as about the birth of Jesus.
The story related in the Protoevangelium of James begins with Joachim, Mary’s father, and Anna, her mother, who are suffering because of their childlessness. They each call out to God for a child and promise to give the child to the priests to serve in the temple if they are blessed with one. God hears their prayers and tells them they will have a child. When Mary is born, they keep close watch over her to make sure she cannot come into contact with any unclean thing, keeping her in her sanctuary-bedroom most of the time. At the age of three, Mary is taken to the temple and given to the priest who prophesies over her: “The Lord has magnified thy name in all generations. In thee, on the last of the days, the Lord will manifest His redemption to the sons of Israel” (§.; 7).
According to the Protoevangelium of James, Mary lives in the temple until she is twelve (§ 8); at that time, the priests decide she should marry, as it would not be proper for her to continue living in the temple. Joseph is chosen by lot to marry her, but he objects: “I have children, and I am an old man, and she is a young girl. I am afraid lest I become a laughing-stock to the sons of Israel” (§ 9). The priest warns Joseph that he needs to submit to God’s will or face judgment, so he acquiesces out of fear.
Time passes, and the angel announces to Mary that she will bear a child. By this time, she is about sixteen years old and still a virgin (§ 12). The exchange between Mary and the angel, as related in the Protoevangelium of James, is similar to that found in the New Testament. After six months, Joseph discovers Mary is pregnant. He is in anguish because it was his job to make sure nothing happened to her, and now it appears he has failed. Mary explains the circumstances surrounding her pregnancy, but Joseph is torn because, on one hand, he does not want to conceal a sin if Mary has been unfaithful, and, on the other hand, he does not want to fight against God if Mary’s baby is indeed miraculously conceived.
According to the Protoevangelium of James, the priests find out that Mary is pregnant and accuse Joseph of a horrible sin, as he was supposed to keep her pure (§ 15). However, they administer a test, “the water of ordeal of the Lord” (similar to that found in Numbers 5:11–31), and both are found to be innocent of any sin (§ 16).
Then comes the Roman decree for everyone to register in their hometown, so Joseph travels to Bethlehem with Mary and some of his sons by an earlier marriage (§ 17). He debates whether he should register Mary as his wife or his daughter. On the way to Bethlehem, Mary goes into labor, so they find a cave, and Joseph goes to look for a midwife. He finds a midwife who seems to know all about Mary and the situation, and she reassures Joseph. Jesus is born (§ 19).
In the timeline presented in the Protoevangelium of James, the magi show up in Jerusalem soon after Jesus’ birth, and commotion follows. Herod orders the killing of all the babies in Bethlehem, but Mary and Joseph escape. However, John the Baptist is in danger, so he is hidden. When John’s father, Zacharias, will not give him up, he is killed (§ 23). Simeon, who later sees Jesus in the temple, is chosen by lot to replace Zacharias in the temple.
The Protoevangelium of James is the first work to insist that Mary remained a perpetual virgin. Joseph marries her simply to have her legally live in his home and had no intention of ever having sexual relations with her. He already has children through a previous marriage, so the “brothers” of Jesus are merely His stepbrothers and older than He is.
Scholarly consensus is that the Protoevangelium of James was written in the mid-second century; thus, is could not have been written by Jesus’ half-brother (or stepbrother, as this work would maintain). Since it is pseudepigraphal (written by someone claiming to be someone else) the Protoevangelium of James was rejected by the church. Origen speaks of it in the third century as of dubious origin. The work has been condemned by church councils and church officials through the years, and even by the Catholic Church, which teaches the perpetual virginity of Mary.
While it is natural to be curious about the details of Jesus’ (and Mary’s) upbringing, God has told us all we need to know in the New Testament. Some imaginative speculation may be acceptable, but it is unacceptable to represent that speculation as truth, and this appears to be what the author of the Protoevangelium of James has done.