Thousands of police officers from around the United States attended the funeral Friday of a New York City police officer who was killed on patrol, making him the third officer killed in the city since December.

Police arrived from all parts of the country to show their solidarity during a time of strong scrutiny of police departments around the nation, following the death of a number of unarmed black men at the hands of officers.

Security was heavy for the funeral of Brian Moore, which took place at a Catholic Church on Long Island, 60 kilometers east of Manhattan.

New York Police Department Commissioner Bill Brattan said "Brian's death comes at a time of great challenge. We are increasingly bearing the brunt of loud criticism. We cannot be defined by that criticism.''

The 25-year-old policeman died Monday, two days after he was shot in Queens while trying to question a man during a patrol. Moore, who had followed his father and uncle into the NYPD, was promoted posthumously to the rank of detective.

New York City Mayor Bill de Blasio said "Brian Moore represented the best of New York City."

His shooting comes only five months after two other New York City police officers, Rafael Ramos and Wenjian Liu, were killed in their patrol car, by a man who wanted revenge for the deaths of African Americans at the hands of police.

At the funerals for those officers, hundreds of police turned their backs to Mayor de Blasio, saying he fanned hostility towards the police. At Friday's funeral, there was no such sign of disrespect, signaling that relations between the mayor and police have improved.

The suspect in Moore's killing, Demetrius Blackwell, was arrested shortly after the shooting and faces murder charges.

Friday's funeral comes on the same day as the U.S. Department of Justice opened an investigation into possible civil rights violations by the Baltimore Police Department, following the death of a black man in police custody that triggered riots. Six police officers have been charged in connection with the death of Freddie Gray.