Funeral arrangements are set for three Baton Rouge police officers shot to death in an ambush by a lone gunman.

Visitation is set Thursday evening for city police department officer Matthew Gerald, 41, the Army and Marine veteran who had graduated from the police academy earlier this year. Gerald's funeral is set for Friday morning.

Visitation and funeral services for East Baton Rouge Parish Sheriff's Deputy Brad Garafola, 45, follow on Saturday. Garafola was a 24-year veteran of the sheriff's office.

Services for Montrell Jackson, 32, are set for Monday. Jackson had been with the Baton Rouge Police Department for 10 years when he was killed.

All three were fatally shot in what police said was an ambush by Gavin Long, 29, of Kansas City, Missouri. Three other officers were wounded.

Long died in the ensuing gunfight with police.

Long's motive remains unclear. The shootout came as the city was already on edge after protests and arrests following the video-recorded July 5 shooting death of Alton Sterling, a black man, during an altercation with two Baton Rouge police officers.

Long was black, as was one of the slain officers, Jackson. Jackson had written on Facebook days before the shooting about the pressures he faced as a black man and a police officer.