That night Joseph left for Egypt with the child and Mary, his mother, and they stayed there until Herod’s death. This fulfilled what the Lord had spoken through the prophet: “I called my Son out of Egypt.” Matthew 2:14-15
"Jesus was born in Bethlehem in Judea, during the reign of King Herod. About that time some wise men from eastern lands arrived in Jerusalem, asking, 2 “Where is the newborn king of the Jews? We saw his star as it rose, and we have come to worship him.”
3 King Herod was deeply disturbed when he heard this, as was everyone in Jerusalem. 4 He called a meeting of the leading priests and teachers of religious law and asked, “Where is the Messiah supposed to be born?”
5 “In Bethlehem in Judea,” they said, “for this is what the prophet wrote:
6 ‘And you, O Bethlehem in the land of Judah,
are not least among the ruling cities of Judah,
for a ruler will come from you
who will be the shepherd for my people Israel.’”
7 Then Herod called for a private meeting with the wise men, and he learned from them the time when the star first appeared. 8 Then he told them, “Go to Bethlehem and search carefully for the child. And when you find him, come back and tell me so that I can go and worship him, too!”
9 After this interview the wise men went their way. And the star they had seen in the east guided them to Bethlehem. It went ahead of them and stopped over the place where the child was. 10 When they saw the star, they were filled with joy! 11 They entered the house and saw the child with his mother, Mary, and they bowed down and worshiped him. Then they opened their treasure chests and gave him gifts of gold, frankincense, and myrrh.
12 When it was time to leave, they returned to their own country by another route, for God had warned them in a dream not to return to Herod.
13 After the wise men were gone, an angel of the Lord appeared to Joseph in a dream. “Get up! Flee to Egypt with the child and his mother,” the angel said. “Stay there until I tell you to return, because Herod is going to search for the child to kill him.”
14 That night Joseph left for Egypt with the child and Mary, his mother, 15 and they stayed there until Herod’s death. This fulfilled what the Lord had spoken through the prophet: “I called my Son out of Egypt.”
16 Herod was furious when he realized that the wise men had outwitted him. He sent soldiers to kill all the boys in and around Bethlehem who were two years old and under, based on the wise men’s report of the star’s first appearance. 17 Herod’s brutal action fulfilled what God had spoken through the prophet Jeremiah:
18 “A cry was heard in Ramah—
weeping and great mourning.
Rachel weeps for her children,
refusing to be comforted,
for they are dead.”
19 When Herod died, an angel of the Lord appeared in a dream to Joseph in Egypt. 20 “Get up!” the angel said. “Take the child and his mother back to the land of Israel, because those who were trying to kill the child are dead.”
21 So Joseph got up and returned to the land of Israel with Jesus and his mother. 22 But when he learned that the new ruler of Judea was Herod’s son Archelaus, he was afraid to go there. Then, after being warned in a dream, he left for the region of Galilee. 23 So the family went and lived in a town called Nazareth. This fulfilled what the prophets had said: “He will be called a Nazarene.”