Jesus was born in Bethlehem in Judea. This happened while Herod was king of Judea. After Jesus' birth, Wise Men from the east came to Jerusalem.
References for Matthew 2:1
They asked, "Where is the child who has been born to be king of the Jews? When we were in the east, we saw his star. Now we have come to worship him."
When King Herod heard about it, he was very upset. Everyone in Jerusalem was troubled too.
So Herod called together all the chief priests of the people. He also called the teachers of the law. He asked them where the Christ was going to be born.
"In Bethlehem in Judea," they replied. "This is what the prophet has written. He said,
" 'But you, Bethlehem, in the land of Judah, are certainly not the least important among the towns of Judah. A ruler will come out of you. He will be the shepherd of my people Israel.' " (Micah 5:2)
Then Herod called for the Wise Men secretly. He found out from them exactly when the star had appeared.
He sent them to Bethlehem. He said, "Go! Make a careful search for the child. As soon as you find him, bring me a report. Then I can go and worship him too."
After the Wise Men had listened to the king, they went on their way. The star they had seen when they were in the east went ahead of them. It finally stopped over the place where the child was.
When they saw the star, they were filled with joy.
The Wise Men went to the house. There they saw the child with his mother Mary. They bowed down and worshiped him. Then they opened their treasures. They gave him gold, incense and myrrh.
But God warned them in a dream not to go back to Herod. So they returned to their country on a different road.
When the Wise Men had left, Joseph had a dream. In the dream an angel of the Lord appeared to him. "Get up!" the angel said. "Take the child and his mother and escape to Egypt. Stay there until I tell you to come back. Herod is going to search for the child. He wants to kill him."
References for Matthew 2:13
Joseph got up. During the night, he left for Egypt with the child and his mother Mary.
They stayed there until King Herod died. So the words the Lord had spoken through the prophet came true. He had said, "I chose to bring my son out of Egypt."(Hosea 11:1)
Herod realized that the Wise Men had tricked him. So he became very angry. He gave orders concerning Bethlehem and the area around it. All the boys two years old and under were to be killed. This agreed with the time when the Wise Men had seen the star.
In this way, the words the prophet Jeremiah spoke came true. He had said,
"A voice is heard in Ramah. It's the sound of crying and deep sadness. Rachel is crying over her children. She refuses to be comforted, because they are gone." (Jeremiah 31:15)
After Herod died, Joseph had a dream while he was still in Egypt. In the dream an angel of the Lord appeared to him.
References for Matthew 2:19
The angel said, "Get up! Take the child and his mother. Go to the land of Israel. Those who were trying to kill the child are dead."
So Joseph got up. He took the child and his mother Mary back to the land of Israel.
But then he heard that Archelaus was king of Judea. Archelaus was ruling in place of his father Herod. This made Joseph afraid to go there. Warned in a dream, Joseph went back to the land of Galilee instead.
There he lived in a town called Nazareth. So what the prophets had said about Jesus came true. They had said, "He will be called a Nazarene."