Mr. Bryant insisted that Mr. Gray’s death would not “be in vain.” He vowed that Baltimore residents would “keep demanding justice” but also issued a pointed rebuke to the congregation, telling members that black people must take control of their lives and force the government and police to change.

“This is not the time for us as a people to be sitting on the corner drinking malt liquor,” he roared, as his voice rose and the congregation, clapping, rose to its feet. “This is not the time for us to be playing the lottery or at the horsing casino, this is not the time for us to be walking down with our pants hanging down.”

He said, “Get your black self up and change this city!” and added, “I don’t know how you can be black in America and be silent. With everything we’ve been through, ain’t no way in the world you can sit here and be silent in the face of injustice.”

But as the day went on, the mood changed. The violence appears to have begun inside the Mondawmin Mall. Erica Ellis, 23, who works in a Game Stop store there, said the mall was shut down at 2 p.m., not long after Mr. Gray’s funeral cortege left for his burial.

She said she went outside and saw a big line of police officers and hundreds of young people who started throwing rocks and bricks. But police did not respond immediately, she said. “The police officers were trying as hard as they can not to hurt the people’s children,” she said.

At the corner of North Fulton and West North Avenues, looters could be seen breaking into stores and walking out with cases of food and water while hundreds of police officers in riot gear gathered about four blocks away.

When a pair of police cruisers tried to enter the area, young men threw bottles. Several of the men wore surgical masks. Some carried baseball bats, others carried pipes. While several people held signs that said “Stop the war,” protesting peacefully, the rising chaos surrounded them: a broken-down BMW sat empty in the middle of the street, shards of glass from convenience store windows lay on the pavement and a young man carrying bolt cutters walked by.