Updated

Vice President Joe Biden paid tribute Thursday to the three Baton Rouge officers ambushed earlier this month and called for healing, telling friends and relatives at a church vigil, "This is not about black and white, this is about a city... this is about what we're supposed to be."

Attorney General Loretta Lynch also spoke, honoring the "public safety officers who served this city with grace and compassion."

Lynch hailed the officers as heroes and said the gathering showed the community was united by "collective heartache" and a "common humanity."

A gunman shot and killed Baton Rouge police officers Matthew Gerald and Montrell Jackson and sheriff's deputy Brad Garafola outside a gas station convenience store.

Baton Rouge Police Chief Carl Dabadie described the men as "the best of the blue."

Three other officers were injured. Sheriff's Deputy Nicholas Tullier was critically wounded and remains in a hospital.

"We have to uproot hate and violence and replace it with love," Governor John Bel Edwards added.

Rosie Hernandez, whose nephew who is a Baton Rouge police officer, said she was confident the vigil would help heal and unite a community grappling with racial tensions.

Investigators said the gunman was targeting police when he ambushed the officers in Baton Rouge, where racial tensions had been mounting amid protests over a deadly police shooting. Alton Sterling, 37, a black man, was shot and killed during a struggle with two white police officers July 5. The killing was captured on cellphone video and circulated widely on the internet.

Jackson, a corporal, was a 10-year veteran of the Baton Rouge Police Department. He was married and had a 4-month-old son. Days before he was shot to death, Jackson posted a message on Facebook about the difficulties of being both a black man and a police officer in the tumultuous aftermath of Sterling's shooting.

"Please don't let hate infect your heart. This city MUST and WILL get better," wrote Jackson, whose funeral was Monday.

Garafola, whose funeral was Saturday, is survived by a wife and four children: sons ages 21 and 12, and daughters ages 15 and 7.

East Baton Rouge Sheriff Sid Gautreaux said Garafola "went down fighting," with surveillance video showing him firing at the gunman as bullets hit the concrete around him.

Gerald was a former Marine and Army veteran who served three tours in Iraq before joining the police force nine months ago. His wife, Dechia Gerald -- now a widow with two young daughters -- called him "my blue-eyed rock" in a written tribute. She expressed hope that his legacy will "bridge the gap and foster peace in the country he lived, loved and died for."

The Associated Press contributed to this report.