Opposition MPs have voted to save the long-gun registry, defeating a Conservative MP's private member's bill in a showdown that was ultimately decided by a handful of New Democrats.

MPs voted 153-151 in favour of a Liberal motion that kills Tory MP Candice Hoeppner's private member's bill to scrap the registry.

The vote hinged on a handful of votes from New Democrat MPs, who were permitted to vote freely by their leader, Jack Layton. The Conservatives were behind Hoeppner's bill, while the Bloc had vowed to support saving the registry. Liberal Leader Michael Ignatieff whipped the vote, demanding his caucus vote against the bill.

Despite the result, Prime Minister Stephen Harper said the Tories will continue to work toward dismantling the registry.

"With the vote tonight its abolition is closer than it has ever been," Harper told reporters immediately after the vote. "The people of the regions of this country are never going to accept being treated like criminals and we will continue our efforts until this registry is finally abolished."

Hoeppner's bill made it through second reading by a vote of 164 to 137, with 12 New Democrats and eight Liberals voting in support.

After the bill passed second reading and went back to committee, MPs began hearing from a wide variety of groups begging for the registry to be saved. Then, the committee heard that an RCMP audit of the program found it to be successful.

On the other side were shooting sports enthusiasts and hunters, who argued there was no proof that the long gun registry helps crack down on crime.

In Wednesday's vote, all eight Liberals and six of the 12 New Democrats who initially backed Hoeppner's bill voted to kill it.

After the vote, Ignatieff said he was proud of his caucus, and hopes the Tory desire to kill the registry is "a settled question."

"We stood with victims, we stood with emergency room doctors, we stood with the police and the Mounties, all of whom say we need a long-gun registry for the public security of Canadians," he said.

Ignatieff said he will follow through on his party's proposals to change the registry to make it more palatable to rural Canadians.

"If you care about public safety in this country, you want a gun registry. Period," Ignatieff said.

The six NDP MPs who changed their votes Wednesday to back the registry had indicated in recent days their intention to do so.

Layton said after the vote the result will allow him to also propose changes to the registry to make it better and easier to use.

"We want the registry to be repaired and to have it work well for everybody and so we're going to work to build those kind of bridges," Layton told reporters. "I think Mr. Harper wants to portray rural and northern Canada, even Aboriginal communities, as though all they care about is guns and a registration process. I know that's not true."

After the vote, Hoeppner singled out Liberal and NDP MPs who changed their position and voted to save the registry.

"Right now if you live in the Yukon, it's a pretty sad day for you, because your member of Parliament's vote kept the long-gun registry," she said, referring to Liberal MP Larry Bagnell. "For people in the Yukon, people in North Bay, people in Victoria, people throughout Canada, look at how your member of Parliament voted."