Northern Ireland is to become the first part of the UK to make paying for sex a criminal offence.
The Northern Ireland Assembly has passed the Human Trafficking and Exploitation Bill, which includes a clause criminalising payment for sex.
The private member's bill was brought before the house by the Democratic Unionist Party (DUP) peer Lord Morrow and passed its final stage on Tuesday.
The bill will be submitted to the Queen for Royal Assent, before becoming law.
Lord Morrow told the assembly his Christian faith underpinned his decision to bring forward the wide-ranging legislation.
He described human trafficking as "a heinous crime" that had to be tackled in Northern Ireland.
The peer acknowledged that clause 15 of the new legislation, which criminalises those who pay for sexual services, was "clearly the most divisive aspect of my bill".
At present, prostitution legislation criminalises aspects of selling sex, for example running a brothel.
Justice Minister David Ford, who described the bill as "ground-breaking", said he still had misgivings about the prostitution clause.
Mr Ford said it had "diverted the focus away from some of the other important measures and into the moral issues surrounding the purchase of sex".
Opponents of the clause have argued that it would be difficult to enforce and claimed a ban no paying for sex would push vulnerable sex workers further underground.
Green Party MLA Steven Agnew said he remained concerned that the clause involving prostitution could be "counterproductive in relation to the aims of the bill".
Lord Morrow's bill could lead the way in efforts by campaigners to outlaw the purchase of sex across the island of Ireland.
Last month, the Irish government announced that it also plans to criminalise the payment of prostitutes in the Republic of Ireland.
Irish Justice Minister Frances Fitzgerald published a draft bill that proposed wide-ranging reforms to sexual offences legislation, including a new measure making it a crime to pay for sex.