RALEIGH, N.C. — Legislation ensuring that people who’ve received payments from states after being sterilized decades ago are not penalized in qualifying for federal benefits was signed Friday by President Barack Obama.

The bipartisan legislation was introduced by North Carolina’s Republican Sen. Thom Tillis. It excludes the payments from calculations designed to determine whether someone can enroll for Medicaid, food stamps, disability assistance and other benefits.

Tillis’ office says more than 30 states had eugenics programs or compulsory sterilization laws during the 20th century. In North Carolina, 7,600 people were sterilized. North Carolina and Virginia are the only states so far that have passed laws compensating living victims. Tillis championed North Carolina’s compensation law while state House speaker.