By Lawrence Hurley

(Reuters) - Before the killing of three law enforcement officers on Sunday and the fatal shooting of a black man by police earlier this month, Baton Rouge was a city divided between the police and the policed.

Tensions in the Louisiana state capital go back years. For many residents, the city's police force has been viewed as overly aggressive and unrepresentative of a city where more than half the 230,000 people are black and where racial problems date back decades.

Minorities are "very wary of police and often afraid of them," says Michele Fournet, a veteran Baton Rouge criminal defense lawyer.

It was not clear whether there was a link between Sunday's shooting of the police officers and the recent unrest over the police killings of black men in Baton Rouge and Minnesota. Police told CNN that the shootings on Sunday did not appear to be race-related.

Officers were responding to a call of shots fired when they were shot in what Baton Rouge Mayor Kip Holden described as "an ambush-style deal." Three officers were killed and three others wounded. The suspect in the shooting is dead.

"It is unspeakable that these men risking their lives to protect and serve this community were taken out the way that they were," Louisiana Governor John Bel Edwards told a news briefing.

"The hatred just has to stop," he said.

Baton Rouge has been one of America's most crime-plagued cities. In 2015, it had 60 homicides, 98 rapes and 809 robberies, among the highest rates of violent crime for a city of its size in the United States.

In recent years, activists in the city have urged law enforcement to spend more time in neighborhoods as part of "community policing."

Many would also like the city to hire more black officers.

Such calls having been growing across the country since the fatal police shooting of black teenager Michael Brown by a white officer in Ferguson, Missouri, in 2014.

A wave of anti-police protests has since spread, fueled by a series of fatal encounters between police and members of minority groups.

“Whether it’s Baton Rouge or Ferguson or Baltimore or Minnesota, we need more community policing," said Cleve Dunn Jr., a black businessman and political consultant in Baton Rouge.

CONSENT DECREE

A Baton Rouge police spokesmen said the department had made significant strides toward diversity in its force.

In 1980, when Baton Rouge was put under a federal consent decree to improve its minority recruiting, about 10 percent of the department’s 516 employees were black. As of June this year, 201 of 657 officers are black, or 30 percent, according to numbers provided by the police department.

Blacks made up about 55 percent of Baton Rouge’s population in 2010, according to U.S. government data.

Alton Sterling, the Baton Rouge man shot by police on July 5, had peddled CDs for years and law enforcement officers would have known he was not a threat if they were more familiar with the area, local residents said.

One officer is notorious for harassing local black residents to the point where he has been given a street nickname of “Bro Stupid,” said Burnell Williams, who works with at-risk youth and ex-prisoners for the nonprofit group Against All Odds.

Michael Mitchell, 33, a motivational speaker and minister who lives near the store where Sterling was killed, said relations had long been strained between the police and the neighborhood where Sterling was killed.

“It added a match to fuel that was already there,” he said.

In Dallas, where five police officers were killed on July 7 during an otherwise peaceful protest over the Louisiana and Minnesota shootings, police chief David Brown told reporters that community policing was the best way to deter crime and protect officers.

Brown, a 33-year department veteran, noted that 2015 was the 12th year of crime reduction in Dallas, more than any other major American city.

Police "have done this by also protecting the civil rights of our citizens," Brown said.

(Reporting by Lawrence Hurley in Washington; Additional reporting by Letitia Stein in Baton Rouge, La.; Editing by Jason Szep and Peter Cooney)