The event is described in the Gospel of Luke 2:22–40. According to the gospel, Mary and Joseph took the baby Jesus to the temple in Jerusalem forty days after his birth to complete Mary's purification after childbirth and to perform the redemption of the firstborn, in obedience to the Law of Moses (Leviticus 12, Exodus 13:12-15, etc…).
Upon bringing Jesus into the temple, the Holy Family encountered Simeon the Righteous. The Gospel records that Simeon had been promised that 'he should not see death before he had seen the Messiah of the Lord.' (Luke 2:26). Simeon prayed the prayer that would become known as the Nunc Dimittis, or Canticle of Simeon, which prophesied the redemption of the world by Jesus: 'Lord, now lettest Thou Thy servant depart in peace, according to Thy word, for mine eyes have seen Thy salvation, which Thou hast prepared before the face of all people, a light to enlighten the Gentiles, and the glory of Thy people Israel.' (Luke 2:29-32).
Simeon then prophesied to Mary: 'Behold, this child is set for the fall and rising again of many in Israel; and for a sign which shall be spoken against - yea, a sword shall pierce through thy own soul also—that the thoughts of many hearts may be revealed.' (Luke 2:34-35).
The elderly prophetess Anna was also in the temple, and offered prayers and praise to God for Jesus, and spoke to everyone there about Jesus and his role in the redemption of Israel (Luke 2:36-38).