Estonia was forcibly incorporated in the Soviet Union in 1940 and regained its independence only in 1991 .