Switzerland has raised the legal age of prostitution, in a measure that brings it in line with an international convention it signed in 2010.

Legislators in the national parliament's lower house voted unanimously Tuesday to make it a criminal act to pay for sex with anyone who is under 18 years old.

The legal age for sex work had been 16.

The measure was passed to harmonize Swiss law with an international convention aimed at protecting children from any form of sexual exploitation or abuse. The Council of Europe treaty has been signed by 46 countries and ratified by 28 of them.

Switzerland had been one of the few states in Europe to allow prostitution by anyone who is at least 16, the age of sexual consent, although some cantons — which are akin to provinces — and cities set stricter rules.

Under the new law, encouraging prostitution by anyone under 18 becomes a criminal offence. People who pay for sex with 16-year-old or 17-year-old prostitutes would face up to three years in prison.

People who consume underage pornography also could be prosecuted. Pimps and managers of brothels or escort services that hire anyone under 18 could face up to 10 years in prison.

Prostitution has been legal in Switzerland since 1942 and is treated much like any other economic activity, with the income of sex workers taxed and subject to social insurance.

However, street prostitution is illegal unless in designated areas.