Canada's minority government has lost a bid to end a rifle and shotgun registry which police say helps to trace guns used in crimes.
Members of parliament voted 153 to 151 to defeat a bill that would have ended the registry, but Conservative PM Stephen Harper vowed to try again.
He said opposition to the regulation was stronger "than it has ever been".
Opponents say the programme is ineffective and treats rural Canadian hunters and farmers like criminals.
The BBC's Lee Carter, in Toronto, says the ballot was nailbitingly close as MPs stood up in Canada's Parliament to cast their vote.
The bill was defeated by an ad hoc parliamentary coalition of Liberals, New Democrats and Bloc Quebecois members.
Canada has only a fraction of the gun crime of its neighbour to the south, the US, but has suffered shocking incidents involving firearms, our correspondent says.
These include the shooting deaths of 14 women killed by a gunman at a Montreal university in 1989.