The Gospel According to Matthew relates how at Jerusalem the Magi attracted the interest of King Herod I of Judaea by announcing Jesus’ birth: “Where is the child who has been born king of the Jews? For we observed his star at its rising, and have come to pay him homage” (Matthew 2:2). Having already learned the place of Jesus’ birth from the priests and scribes, Herod extracted from the Magi the exact date on which the star heralding the birth appeared as confirmation of the biblical prophecy. He then sent them to see the infant Jesus, requesting that they disclose upon their return his exact location. They continued on to Bethlehem, where they worshipped Jesus and offered him gifts.
Warned in a dream not to return to Herod, “they left for their own country by another road” (Matthew 2:12).
Source: britannica.com