German lawmakers have approved a bill to make life safer for sex workers, including making the use of condoms obligatory.

Legislation in 2002 that legalized prostitution gave sex workers social benefits but led to the rapid growth of unregulated brothels, prompting calls for tighter controls. The bill approved Thursday calls for stricter government regulation of such establishments and their operators.

Sex workers will have to register and receive health advice at least every two years, which critics say will merely prompt many to work illegally.

German officials say it's important to set a standard on that backs demands, but have conceded that verifying their use will be difficult. The is to take effect in July 2017.