A Supreme Court judge in Brazil has suggested legalizing cannabis and cocaine in order to tackle the problem of drug gangs.

Justice Roberto Barroso, speaking in an interview with Reuters, said it was necessary to 'legalise marijuana now,' rather than spending billions of dollars fighting its use.

"Unlike the United States and Europe, where the problem lies in the impact drugs have on consumers, in Brazil the problem lies in the power drug traffickers have over poor communities," Barroso said.

"I can assure you it is only a matter of time. Either we legalize marijuana now or we do it in the future after we have spent billions and incarcerated thousands."

"If that works, we can easily move to legalize cocaine. If you want to break the power of traffickers you need to consider legalizing cocaine."

Barroso's opinion is something of a rarity in a country that traditionally has a more conservative approach to tackling drug-related crime, although the Barroso was one of three Supreme Court judges who did vote in favour of decriminalizing cannabis.

The judge said the war on drugs had not worked, and suggested a new approach was necessary to tackle the problem of gangs who make some of their money from the sale of illegal drugs.

"I'm not sure if my proposal for legalisation will work, but I'm sure that the war on drugs has not," he added. "We cannot just keep repeating the same mistakes over and over again."