What made Joseph decide return to Israel from Egypt?

An angel appeared to him in a dream and told him to.

When Herod was dead, behold, an angel of the Lord appeareth in a dream to Joseph in Egypt,

Saying, Arise, and take the young child and his mother, and go into the land of Israel: for they are dead which sought the young child's life. Matthew 2:19-20