The 41-year-old married dad was remembered by hundreds of family and friends Friday.
Hundreds gathered in Baton Rouge, Louisiana, Friday to honor police officer Matthew Gerald, one of the three cops shot dead by a troubled ex-Marine last weekend.
The 41-year-old, himself a former Marine and Iraq veteran, only joined the Baton Rouge Police Department last year. He completed his training earlier this year and had been permitted to ride by himself just two weeks before his death.
Following a visitation and a funeral service at Healing Place Church, he was laid to rest at Louisiana National Cemetery
At the funeral, Gerald's childhood friend Dave Mulkey said he'd texted the officer as protests broke out following the death of Alton Sterling in Baton Rouge.
"I told him to be careful, and to keep a cool head," Mulkey recalled. But his friend responded: "I'm going to do what I got to do to keep you all safe, old boy."
His partner, 11-year police veteran Cpl. Lester Mitchell, said they'd also spoken about "the madness, how much it was putting a strain on the community, police relations."
But Gerald "was a protector," he said. "It was just in his DNA."
He leaves behind his wife and two daughters, ages 3 and 9.
He lost his life Sunday along with Brad Garafola, 45, and Montrell Jackson, 32, who will be remembered at services next week.
Read: Eyewitness Video Captures Terrifying Moments of Baton Rouge Shooting
Another of the deputies injured in the shooting was released from the hospital Friday.
Doctors, nurses and his comrades in blue cheered and saluted as Deputy Bruce Simmons left the hospital. He was shot in the arm but is expected to make a full recovery.
Watch: Cop Killed in Baton Rouge Wrote Chilling Post Before Death: I Get Hateful Looks