BALTIMORE — Rioters plunged part of Baltimore into chaos Monday, torching a pharmacy, setting police cars ablaze and throwing bricks at officers hours after thousands mourned the man who died from a severe spinal injury he suffered in police custody.

The governor declared a state of emergency and called in the National Guard to restore order — but authorities were still struggling to quell pockets of unrest after midnight.

The violence, which began in West Baltimore — within a mile of where Freddie Gray was arrested and pushed into a police van earlier this month — had by the end of the day spread to East Baltimore and neighborhoods close to downtown and near the baseball stadium.

Attorney General Loretta Lynch, in her first day on the job, said she would send Justice Department officials to the city in coming days. A weeklong, daily curfew was imposed beginning Tuesday from 10 p.m. to 5 a.m., the mayor said, and Baltimore public schools announced that they would be closed on Tuesday. At least 15 officers were hurt, including six who remained hospitalized late Monday, police said. Two dozen people were arrested.

Officers wearing helmets and wielding shields occasionally used pepper spray to keep the rioters back. For the most part, though, they relied on line formations to keep protesters at bay.

Monday’s riot was the latest flare-up over the mysterious death of Gray, an African-American whose fatal encounter with officers came amid the national debate over police use of force, especially when black suspects are involved. Police have declined to specify the races of the six officers involved in his arrest, all of whom have been suspended with pay while they are under investigation.

But Gray’s family said violence is not a way to honor him.

“I think the violence is wrong,” Gray’s twin sister, Fredericka Gray, said late Monday. “I don’t like it at all.”

The attorney for Gray’s family, Billy Murphy, said the family had hoped to organize a peace march later in the week.

Emergency officials were constantly thwarted as they tried to restore calm in the affected parts of the city of more than 620,000 people. Firefighters trying to put out a blaze at a CVS store were hindered by someone who sliced holes in a hose connected to a fire hydrant, spraying water all over the street and nearby buildings. Later Monday night, a massive fire erupted in East Baltimore that a spokesman for Mayor Stephanie Rawlings-Blake initially said was connected to the riots. He later texted an AP reporter to say officials are still investigating whether there is a connection.

The Mary Harvin Transformation Center was under construction and no one was believed to be in the building at the time, said the spokesman, Kevin Harris. The center is described online as a community-based organization that supports youth and families.

Kevin Johnson, a 53-year-old resident of the area, said the building was to have been earmarked for the elderly. Donte Hickman, pastor of a Baptist church that has been helping to develop the center, shed tears as he led a group prayer near the firefighters who fought the blaze.

“My heart is broken because somebody obviously didn’t understand that we were for the community, somebody didn’t understand that we were working on behalf of the community to invest when nobody else would,” he said.

Earlier Monday, the smell of burned rubber wafted in the air in one neighborhood where youths were looting a liquor store. Police stood still nearby as people drank looted alcohol. Glass and trash littered the streets, and other small fires were scattered about. One person from a church tried to shout something from a megaphone as two cars burned.

“Too many people have spent generations building up this city for it to be destroyed by thugs, who in a very senseless way are trying to tear down what so many have fought for, tearing down businesses, tearing down and destroying property, things that we know will impact our community for years,” said Rawlings-Blake, a lifelong resident of the city.

Police urged parents to locate their children and bring them home. Many of those on the streets appeared to be African-American youths, wearing backpacks and khaki pants that are part of many public school uniforms.

The riot broke out just as high school let out, and at a key city bus depot for student commuters around Mondawmin Mall, a shopping area northwest of downtown Baltimore. It shifted about a mile away later to the heart of an older shopping district and near where Gray first encountered police. Both commercial areas are in African-American neighborhoods.

Later in the day, people began looting clothing and other items from stores at the mall, which became unprotected as police moved away from the area. About three dozen officers returned, trying to arrest looters but driving many away by firing pellet guns and rubber bullets.

Downtown Baltimore, the Inner Harbor tourist attractions and the city’s baseball and football stadiums are nearly 4 miles away. While the violence had not yet reached City Hall and the Camden Yards area, the Orioles canceled Monday’s game as a safety precaution.

On Monday night, Maryland Congressman Elijah Cummings and about 200 others, including ministers and mostly men, marched arm-in-arm through a neighborhood littered with broken glass, flattened aluminum cans and other debris, in an attempt to help calm the violent outbursts. As they got close to a line of police officers, the marchers went down on their knees. After the ministers got back on their feet, they walked until they were face-to-face with the police officers in a tight formation and wearing riot gear.

In a statement issued Monday, Attorney General Lynch said she would send Justice Department officials to the city in coming days, including Vanita Gupta, the agency’s top civil rights lawyer. The FBI and Justice Department are investigating Gray’s death for potential criminal civil rights violations.

Many who had never met Gray gathered earlier in the day in a Baltimore church to bid him farewell and press for more accountability among law enforcement.

The 2,500-capacity New Shiloh Baptist Church was filled with mourners. But even the funeral could not ease mounting tensions.

Police said in a news release sent while the funeral was under way that the department had received a “credible threat” that three notoriously violent gangs were working together to “take out” law enforcement officers.

Gray was arrested April 12 after making eye contact with officers and then running away, police said. He was held down, handcuffed and loaded into a van without a seat belt. Leg cuffs were put on him when he became irate inside.

He asked for medical help several times even before being put in the van, but paramedics were not called until after a 30-minute ride. Police have acknowledged he should have received medical attention on the spot where he was arrested, but they have not said how his spine was injured. He died on April 19.