RIO DE JANEIRO (Reuters) - Brazil had a record number of murders last year, with homicides rising 3.7 percent from 2016 to 63,880 according to a study released on Thursday, just months before a presidential election in which violence has become a key issue.

In 2017, Brazil had a murder rate of 30.8 per 100,000 people, up from 29.9 in 2016, according to data published by the Brazilian Public Security Yearbook 2018. Drug-scarred Mexico, which also suffered a record number of murders in 2017, had a homicide rate of around 20 per 100,000 people.

The yearbook is published by the Brazilian Forum of Public Security, a think tank.

Triggered by ever-more violent gangs capitalizing on tighter law enforcement budgets and a political void in the wake of massive graft scandals, growing violence is a key voter concern ahead of the October election.

Far-right lawmaker Jair Bolsonaro, who leads polling in the presidential race excluding jailed former president Luiz Inacio Lula da Silva, wants to loosen gun laws and toughen up policing to tackle the rise in violence.

His popularity has forced opponents including centrist former governor Geraldo Alckmin to join forces with law-and-order conservatives to bolster their crime-fighting credentials.

The yearbook data showed that many of the record number of murders, which includes police killed in the line of duty, were concentrated in Brazil’s poorer northeastern states.

The state of Rio Grande do Norte had the highest murder rate in 2017, with 68 murders per 100,000 people, followed by Acre, in the far west of the country bordering Peru, with 63.9 per 100,000 people.

The wealthier state of Sao Paulo had the lowest murder rate of any state, with 10.7 homicides per 100,000 people.

In the absence of comprehensive federal crime data, the Brazilian Public Security Yearbook collects official state-level data and is used as a reference by the federal government.