Not just one of the most cruel and criminal actions in history, it was also the dumbest decision Hitler made in the course of the war. This moron thought he could fight the whole world and stand a chance of winning. And Stalin for his part was rather naive as well, by assuming Hitler would keep his word from the 1939 treaty, even when the warning signs were there. He also reacted slowly and caused more Soviet deaths.
For anyone who's interested more broadly in this, I can recommend the video from the Library of Congress below (found this yesterday in the recommendations segment). It's a talk with an American historian looking at the invasion and events of 1941, which was essentially the year Hitler lost the war.