According to the apocryphal Gospel of James, Mary was the daughter of Saint Joachim and Saint Anne. Before Mary's conception, Anne had been barren and was far advanced in years. Mary was given to service as a consecrated virgin in the Temple in Jerusalem when she was three years old, much like Hannah took Samuel to the Tabernacle as recorded in the Old Testament. Some apocryphal accounts state that at the time of her betrothal to Joseph, Mary was 12–14 years old, and he was thirty years old, but such accounts are unreliable.