Parliament tonight passed prostitution law changes when MPs voted 60-59 in favour of a bill which raised passionate debate and drew the strongest opposition from moral conservatives since homosexual law reform 17 years ago.
Labour MP Tim Barnett's Prostitution Reform Bill will become law after nearly three years of scrutiny, 415 hours of debate by Parliament and its committees and 222 public submissions.
It decriminalises prostitution and establishes a legal framework around the sex industry, with licensed brothels operating under public health and employment laws.
It reached its third reading in Parliament after narrow majorities at previous legislative stages, and when the crunch came there was just one vote that made the difference.
One MP abstained, Labour's Ashraf Choudhary, and if that had not happened there would have been a tied vote and the bill would not have passed.
In his final appeal, Mr Barnett asked Parliament to remove what he called outdated, biased and largely unenforced laws which left real problems untouched.
"Each member here has to live with their vote tonight for the rest of their lives," he said.
"Current law around prostitution wasn't designed to ensure the wellbeing of sex workers. It was planned around what I call a Kiwi prohibition.
"The state licenses massage parlours, knowing they are fronts for prostitution...there is no morality, no consistency in that."
MPs cast conscience votes on the bill, and were not bound by party policy.
National MP Nick Smith captured the essence of opposition from churches and others who have claimed that under the bill's provisions prostitute numbers would double or even treble.
"We must judge this not on whether it is good for sex workers, but whether it is good for New Zealand society," he said.
"Sex should not be for sale. Prostitution is nothing more than paid rape."
All the Green Party's MPs supported the bill and Sue Bradford asked her colleagues not to be swayed by the "classic wave of moral outrage" that had swept over them.
"It is high time we moved into an era where the Victorian hypocrisy of convicting and condemning women who sell sexual services and protecting men who buy them is discarded once and for all," she said.
"I cannot understand why puritanical 19th century concepts of abolitionism still have such a strong hold."
ACT MP Stephen Franks, who urged his party's MPs to oppose the bill, said Parliament had held the wrong debate.
"We're not voting for or against prostitution," he said.
"It is legal now, it will be legal tomorrow. We have a form of licensed brothel industry.
"The bill is a set of instructions to the police and local authorities - and it is flawed. Local authorities would have to decide issues which are tearing Parliament apart."
Transsexual MP Georgina Beyer, a former prostitute, made a desperate appeal to Parliament.
"I support this bill for all the prostitutes I have ever known who died before the age of 20 because of the inhumanity and hypocrisy of a society that would not allow them, or give them the chance, to redeem whatever circumstances made them arrive in this industry," she said.
"This is about accepting what occurs, about accepting that the people who work in this industry deserve some human rights.
Dianne Yates, one of the strongest opponents of the bill, said it was "an absolute mess' and prostitution was exploitation.
She said only three people in her electorate had asked her to vote for it, and hundreds had opposed it.
All the New Zealand First MPs opposed the bill. Peter Brown, a former seaman, said he had seen prostitution all over the world.
"If this bill goes through the industry will expand significantly," he said.
Labour's Winnie Laban had previously opposed the bill, but changed her vote at the last minute.