Protevangelium of James 9

1And Joseph cast down his adze and ran to meet them, and when they were gathered together they went to the high priest and took their rods with them . And he took the rods of them all and went into the temple and prayed. And when he had finished the prayer he took the rods and went forth and gave them back to them: and there was no sign upon them. But Joseph received the last rod: and lo, a dove came forth of the rod and flew upon the head of Joseph. And the priest said unto Joseph: Unto thee hath it fallen to take the virgin of the Lord and keep her for thyself.
2And Joseph refused, saying: I have sons, and I am an old man, but she is a girl: lest I became a laughing-stock to the children of Israel. And the priest said unto Joseph: Fear the Lord thy God, and remember what things God did unto Dathan and Abiram and Korah, how the earth clave and they were swallowed up because of their gainsaying. And now fear thou, Joseph, lest it beso in thine house. And Joseph was afraid, and took her to keep her for himself. And Joseph said unto Mary: Lo, I have received thee out of the temple of the Lord: and now do I leave thee in my house, and I go away to build my buildings and I will come again unto thee. The Lord shall watch over thee.