According to Matthew, Herod the Great slaughtered all boys two years old or less in Bethlehem and its environs (Matthew 2:16-18).
Matthew justifies his story with another shameless trim, this time of Jeremiah 31:15-17,
This is what the Lord says: "A voice is heard in Ramah, mourning and great weeping, Rachel weeping for her children and refusing to be comforted, because her children are no more." This is what the Lord says: "Restrain your voice from weeping and your eyes from tears, for your work will be rewarded," declares the Lord. "They will return from the land of the enemy. So there is hope for your future," declares the Lord. "Your children will return to their own land."(Jeremiah 31:15-17)
Jeremiah 31:15-17 bears no relationship whatever to a dubious mass infanticide perpetrated by Herod the Great. Rachel is weeping over the demise of her own two children, Joseph and Benjamin (Genesis 35:24). Jeremiah uses "Joseph" as a synonym for Ephraim, i.e., the northern kingdom of Israel, and "Benjamin" as a synonym for the southern kingdom, Judah. Ephraim was eradicated by Assyria and Judah would be eradicated by Babylon.
Golden Rule: If an intended Old Testament justification is fraudulent, the New Testament anecdote is a fabrication.
Aside for the thoughtful reader
1. Flavius Josephus does not validate the alleged mass infanticide.
2. This childhood memory of the German-Jewish philosopher Moses Hess (1812-1875) exposes Matthew's guile further,
My pious grandfather was one of those revered scholars who, without using the Torah as a means of subsistence, yet possessed the title and knowledge of a rabbi. Every evening, at the close of his business day, he spent several hours studying the Talmud and its commentaries. But during the "nine days" running up to the fast in remembrance of the destruction of Jerusalem this study was interrupted and he read with his grandchildren the stories and legends of the Jewish exile from Jerusalem. The tears fell upon the snow-white beard of the stern old man as he read those stories and we children would cry and sob too. I remember especially a certain passage that impressed us both deeply. It runs as follows:When the children of Israel were led into captivity by the soldiers of Nebuchadnezzar, their road lay past the grave of our Mother Rachel. As they approached the grave, a bitter wailing was heard. It was the voice of Rachel weeping at the fate of her unhappy children.(Hess, Moses. "Fourth Letter." Rome and Jerusalem, New York: Bloch Publishing Co., 1918, pp. 64-65)