The federal government says its proposed prostitution legislation will crack down on pimps and johns, but advocates for sex-trade workers say it will criminalize prostitution and land sex workers in jail.

Bill C-36, dubbed the protection of communities and exploited persons act, would make it illegal to sell sexual services in public spaces where persons under the age of 18 could be present. Offenders could face a maximum of five years in prison.

"Today our government is making prostitution illegal for the first time," Justice Minister Peter MacKay said in a written statement on Wednesday.

"We are criminalizing the purchase of sexual services and in very specific instances the sale … in areas where young people under the age of 18 could be present," MacKay said during a news conference after the bill was tabled in the House of Commons.

The justice minister said the bill would target johns and the pimps who sell and profit from prostitution, rather than the prostitutes themselves.

"The bill recognizes that the vast majority of those who sell sexual services do not do so by choice. We view the vast majority of those involved in selling sexual services as victims," MacKay said.

While MacKay said the aim of the bill is not to target prostitutes, he said they could face prosecution if found to be selling their services in public spaces where minors could be present.

"They would face fines in most instances," MacKay said.

The bill, which MacKay has described as a "made-in-Canada" model, would also:

Criminalize the advertising of sexual services in print or online, with offenders facing a maximum prison term of five years.

Increase the penalties related to child prostitution.

Provide $20 million to fund programs to help sex workers get out of prostitution.

Sex workers' safety should be priority, NDP says

The new bill comes just two days after the Justice Department released the results of an online consultation that showed two-thirds of the more than 31,000 respondents said selling sex should not be an offence.

The proposed legislation is the government's response to a Supreme Court of Canada ruling in December, which found the country's prostitution laws unconstitutional.

The top court struck down key provisions including laws prohibiting brothels, living on the avails of prostitution and communicating in public with clients, saying the laws were too broad and "grossly disproportionate."

The Supreme Court gave the federal government one year to come up with new legislation.