One Sunday night last fall, a fight broke out between diners at a popular El Salvadorian restaurant in Bridgeport. At first, they were reportedly throwing bottles and furniture at each other. Then came the sound of gunfire inside the El Paraiso restaurant.

Cristobal Hernandez, a 36-year-old cook and landscaper, was shot once in the chest at close range, police said. He died of his wound a few hours later at St. Vincent’s Medical Center on September 25.

Hernandez’s death was the eighth homicide in Bridgeport last year.

Such murders tend to paint a bleak picture of Bridgeport, but the numbers tell a more hopeful story.

For the first six months of 2016, violent crimes dropped by 3.3 percent in Bridgeport, according to preliminary FBI data. Police reported 472 violent crimes, including rape and murder, compared to 488 over the same time period in 2015. Burglaries and motor vehicle thefts in Bridgeport also declined.

The city fared better than the national average. The FBI’s preliminary data showed a 5.3 percent increase in the number of violent crimes across the nation. All violent offenses from murder to rape, aggravated assault and robbery increased nationwide, especially in cities of 1 million and over.

Bridgeport Police Chief Armando Perez says getting to know residents is part of the reason. In 2012, the department started working more closely with community organizations and residents, as part of a new statewide initiative called Project Longevity. The program focuses on lowering violent crime rates on the streets of Bridgeport, Hartford, and New Haven.

“It’s not rocket science. It’s collaboration and talking to one another and having good input with the state department, the locals, the community leaders, and the ministers,” Chief Perez said.

With Project Longevity, state and local law enforcement have turned their attention to helping at-risk youth and building relationships with groups who are most likely to be victims or perpetrators of gang-related gun violence. Since 2011, crime rates in Bridgeport, Hartford and New Haven have decreased by more than half, according to data from Fairfield-based nonprofit Connecticut Against Gun Violence. In 2016, 31 firearm-related homicides were committed in these three cities, which was a record low.

“Five years ago, 31 homicides would have a been a typical year in just one of these towns,” said Ron Pinciaro, the executive director of Connecticut Against Gun Violence. “It’s statistically significant because we’re talking about saving lives.”

Pinciaro also credits the decline of violent crime to the strength of Connecticut’s gun laws. The state has the second lowest rate of gun deaths in the nation, according to the Law Center to Prevent Gun Violence.

“Prevention is key,” Perez said. “You need to engage the community. The community tells you they want to have safe neighborhoods, schools, and not have to worry about being robbed and assaulted. It’s all of us working together.”