Tough new anti-gun legislation comes into force in Brazil on Wednesday, in a bid to curb what the UN says is the world's fourth-highest murder rate.

Under the new rules, anyone carrying a gun without a licence will face a prison sentence.

Permits will be issued only to police, security guards and others in high-risk professions - but they must be at least 25 years old.

Anyone else caught carrying a firearm will face up to four years in prison.

"Those who currently have permits can carry their weapons until midnight, then they turn into pumpkins. After that, they'll be breaking the law if they take their guns out of their houses," a Brazilian justice ministry spokeswoman said on Tuesday, before the law took effect.

The BBC's Steve Kingstone in Sao Paulo says the law is part of a concerted effort by the Brazilian government to reduce the number of people killed in gun-related incidents - nearly 40,000 of them during 2003.

In July, Brazilians were offered an incentive to turn in their guns, with the government offering to pay up to $100 (£56) for every weapon handed over to the police.

So far, nearly 120,000 guns have been collected - a figure far in excess of initial expectations.

Anti-gun campaigners say they hope the new legislation will lead to a real change in behaviour in Brazil, but correspondents say the law may prove difficult to implement in practice.