The early Soviet state sought to remake the family, believing that although the economic emancipation of workers would deprive families of their economic function, it would not destroy the institution but rather base family relations exclusively on mutual affection. The Bolsheviks replaced religious marriage with civil marriage, divorce became easy to obtain, and unwed mothers received special protection. All children, whether legitimate or illegitimate, had equal rights before the law, women gained sexual equality under matrimonial law, inheritance of property was abolished, and abortion was legalized.