French MPs have passed a law that makes it illegal to pay for sex and imposes fines of up to €3,750 (£3,027, $4,274) for those buying sexual acts.
Those convicted would also have to attend classes to learn about the conditions faced by prostitutes.
It has taken more than two years to pass the controversial legislation because of differences between the two houses of parliament over the issue.
Some sex workers protested against the law during the final debate.
The demonstrators outside parliament in Paris, numbering about 60, carried banners and placards one of which read: “Don’t liberate me, I’ll take care of myself”, the AFP news agency reports.
Members of the Strass sex workers’ union say it will affect the livelihoods of prostitutes, estimated to number between 30,000 and 40,000.
But supporters of the law have said it will help fight trafficking networks.
It will also make it easier for foreign prostitutes to get a temporary residence permit in France if they agree to find jobs outside prostitution.
“The most important aspect of this law is to accompany prostitutes, give them identity papers because we know that 85% of prostitutes here are victims of trafficking,” Socialist MP Maud Olivier, who sponsored the legislation, told the Associated Press news agency.
The law was passed in the final vote on the bill in the lower house of parliament by 64 to 12 with 11 abstentions, France’s Le Monde newspaper reports.
It supersedes one from 2003 that penalised sex workers for soliciting.
Correspondents say the predominately right-wing Senate has been opposed to the ban – and parliamentary debates have often ended in deadlock.
Those found guilty for paying for sex will have to pay a first time fine of 1,500 euros, which will more than double for a repeat offence.
Sweden was the first country to criminalise those who pay for sex rather than the prostitutes.
Swedish authorities say the number of women on the streets in the prostitution area in Stockholm has fallen since the legislation was introduced.