Barack Obama _lowres

President Barack Obama, joined by Louisiana Governor John Bel Edwards, right, Brittany Packnett, of the President's Taskforce on 21st Century Policing, second from right, and Terry Cunningham, President of the International Association of Chiefs of Police, left, speaks to media at the bottom of a meeting at the Eisenhower Executive Office Building on the White House complex in Washington, Wednesday, July 13, 2016, about community policing and criminal justice with a group made of activists, civil rights, faith, law enforcement and elected leaders. (AP Photo/Carolyn Kaster) ORG XMIT: DCCK108

President Barack Obama pledged his support to law enforcement officers who were gathered in Washington, D.C. on Friday, following the fatal shooting of three officers in Baton Rouge earlier this week.

“I wanted to come by to make sure all of you knew how grateful the American people are for you service. How appreciative we are of your sacrifice," he told the group of officers during a briefing on the implementation of the President’s Task Force on 21st Century Policing.

Obama told the officers -- many of them dressed in their uniforms -- that "our way of life, our freedoms" depend on law enforcement, and he mentioned speaking to the widows of the three officers who were shot and killed on Sunday in Baton Rouge.

Authorities say 29-year-old Gavin Long carried out a coordinated attack on law enforcement that killed Baton Rouge police officers Montrell Jackson and Matthew Gerald and East Baton Rouge Deputy Sheriff Brad Garafola. Three other officers were injured. One remains in critical condition.

“We have gone through a really tough time these last couple of weeks on a whole bunch of fronts," Obama said.

Obama said he promised the families of the in Baton Rouge officers and five officers killed in Dallas during an attack there, as well as those angry about the deaths of Alton Sterling, a 37-year-old black man who was shot and killed by Baton Rouge police, and Minnesota man, that efforts to unite communities would extend beyond those incidents.

"This is something we need to care about all the time," he said. "This is something we are going to sustain. This is not a one off."

He also pledged to keep working on the issue after he leaves the White House.

“There is exceptional policing being done every day,” he said, adding that community forums, barbecues and viral videos of officers playing basketball with kids or “dancing the nae nae” are good examples of ways to bring police departments closer to the people they serve.

He said he hoped Friday's meeting would allow law enforcement officials to share tips about data, training and community engagement and spread best practices around the country.

"Progress is not going to be as quick as we like and there are going to be misunderstandings sometimes," he said.

Follow Elizabeth Crisp on Twitter, @elizabethcrisp.