Children look through windows that are lined with Prince posters as people line up to see singer Prince as he performs at the Baltimore's Royal Farms Arena on Mother's Day, part of his Rally 4 Peace event in Baltimore. (Jabin Botsford/The Washington Post)

“No curfew.”

That was the catchphrase of the night at Prince’s Rally 4 Peace on Sunday, when thousands of fans crammed into the Royal Farms Arena here to see the protean musician perform in a rare appearance that was announced just days earlier.

After making the audience wait nearly an hour for the show to begin, Prince took the stage to explosive cheers and applause. “To all the families who have lost loved ones . . . tonight we are your servants,” he said before launching into slowed-down, stylized versions of “Let’s Go Crazy,” “Take Me With U,” “Raspberry Beret” and “Baltimore,” the improbably jaunty song he composed specifically for the occasion.

It was at that point that Prince introduced Baltimore City State’s Attorney Marilyn Mosby and her husband, Baltimore City Council member Nick Mosby, who had the best seats in the house, right on the stage. Before leading the audience in the refrain of “U Got the Look,” Prince warned the crowd, “There’s no curfew, so there’s no telling how long this is gonna go.”

The curfew in question had been imposed two weeks earlier by Mayor Stephanie Rawlings-Blake after a night of unrest and destruction of property that was precipitated by the death of Freddie Gray, 25, who was severely injured while in police custody. On May 1, Mosby announced that she would charge six Baltimore officers in Gray’s death, including counts of second-degree murder and involuntary manslaughter.

On this night, Prince cast himself as Baltimore’s pop culture savior, offering up an exhaustive show of hits and newer material as a salve for a community racked by discord and pain. But the downtown Baltimore he came to that night was mellow, even buoyant. The show culminated a weekend crammed with cultural events with reconciliation at their core, including the annual Maryland Film Festival unspooling in the city’s Station North neighborhood, as well as concerts by the Baltimore Symphony Orchestra and the Soulful Symphony. A portion of Prince’s box office sales will go to unnamed local youth charities.

Although many fans wore gray, at Prince’s request, in honor of the man who has come to symbolize the racial, economic and social inequities that have beset West Baltimore for the past century, the mood inside the arena was celebratory. Indeed, most of the concertgoers weren’t from Baltimore, having come from the District, Virginia, suburban Maryland and even Philadelphia to see the legendary showman.

Danielle Jones of Glen Burnie, Md., explained why she was there with her mom: “Because it’s Mother’s Day, because my mother loves Prince and because of Freddie Gray.” (Tickets were priced from $22 to $497; several observers noted that the residents of Sandtown-Winchester, where Gray lived, probably couldn’t afford to attend the concert that was being held in their names. The first hour of the show was played live on the new streaming service Tidal.)

A small group of protesters stood outside the arena before the doors opened, representing the Revolutionary Communist Party and the Stop Mass Incarceration Network. Lori McCann, a retired Prince George’s County police officer, could be heard debating with one of them before going in to see the show. “I just can’t stand it when people out and accuse us of murdering people,” she said of law enforcement officials. “We don’t do that.”

Backed by the all-female trio 3rdeyegirl and joined by a retinue of backup singers and a brass section, Prince brought his usual precision, polish and tireless musical gifts to a string of hits that wound up lasting 2 1/2 hours, most of which found delirious fans singing along to such classics as “Little Red Corvette,” “1999” and “I Would Die 4 U.” He had barely performed for an hour when he seemed to close the show with “Nothing Compares 2 U.” After applause brought him back for an encore, Prince intoned the words “No Curfew” before ripping into “When Doves Cry,” “Sign O’ the Times” and “Hot Thing.” The old-school vibe was complete when rapper Doug E. Fresh showed up to help get into the groove for “Kiss.” (The singers Estelle and Miguel also joined Prince onstage as surprise guests.)

It turned out that would be the first of several encores of the evening, with audience members at one point chanting “No curfew.” It was a joyous, even giddy moment — but the emotional climax came earlier, when Prince led fans in a moving version of “Purple Rain,” during which he made his most politically explicit comments of the night. “The system is broken and we’ve got to fix it,” he said before the song’s lilting chorus. “The next time I come to Baltimore, I want to stay in a hotel owned by you.”