The Baltimore Police Department on Monday reported receiving a "credible threat" that several gangs were planning to try to "take out" law enforcement officers, the same day of a funeral for a city man who died in police custody.
The department urged officers to take steps to ensure their safety.
The death of 25-year-old Freddie Gray has led to protests in the latest outcry over U.S. law enforcement's treatment of minorities. Police say Gray died of a neck injury on April 19 after being arrested on April 12.
At the funeral, a long line of mourners stretched out of the front door of the New Shiloh Baptist Church.
"I am here to show that Freddie's loss of life was not in vain," said Joe Jones, head of the Center for Urban Families, which provides aid to local residents.
"There's a lot of frustration, a lot of disappointment," he said. "This is a microcosm of things that are happening" to young black men across the United States.
Gray's body, clad in a white shirt, black tie and dark pants, lay in an open coffin at the head of the altar of the church, which holds 2,500 people.
A choir accompanied by a small instrumental group performed religious music before the funeral started.
President Barack Obama was sending Broderick Johnson, the head of his initiative for minority males, to attend Gray's funeral, the White House said.
Protests in the largely black city have been mostly peaceful, but vandalism and violence flared during a march on Saturday. Thirty-five people were arrested, six officers were hurt, and Mayor Stephanie Rawlings-Blake and police blamed outside agitators for the unrest.
The protest was the latest expression of a national outcry over a white-dominated U.S. law enforcement establishment that civil rights leaders accuse of routinely mistreating black people.
Gray was arrested when he fled from police in a high-crime area. He was carrying a switchblade knife, and he was put inside a transport van to be taken to a police station.
At some point, Gray suffered the spinal injury that led to his death. City Police Commissioner Anthony Batts said on Friday that officers failed to give him timely medical attention while he was in custody and failed to seatbelt him.
Police have said they would conclude their investigation by Friday and forward the results to state prosecutors. Six police officers have been suspended, and the U.S. Justice Department is investigating the incident for possible civil rights violations.