And in the end, they had fun.

As midnight approached, the Revolution was clearly in the groove on Saturday night at First Avenue.

Guests Maya Rudolph, she of “Saturday Night Live” fame, and singer Kimbra, she of Goyte’s “Somebody I Used To Know” fame, yelped in unison just like Prince had done on “Baby, I’m a Star.” Rudolph danced emphatically and playfully. Glee spread across the face of lead singer/guitarist Wendy Melvoin.

Confetti showered the sold-out crowd, and the fans went wild. The scene felt almost as riotously joyful as when Prince and the Revolution performed “Baby, I’m a Star” during the landmark Purple Rain Tour in 1984.

This is the way the Revolution wanted it to be. This is the way fans wanted it to be. Purple faithful traveled from all over the world (Australia, Costa Rica, England) and all over the country (Colorado, New York, California) to witness a rare three-night stand by Prince’s “Purple Rain”-era band at First Avenue, the club where the 1984 movie was filmed.

Prince’s two ex-wives even showed up as did two former girlfriends, his first manager, two early sidemen and the engineer for his original demo tape — all arriving from out of town.

They came to grieve, exchange hugs, tell stories and share the music that Prince created.

The musicians, significant others and extended family members needed it. And the fans needed it.

“It was necessary to do this. I think people needed to go through this together with the band,” said Owen Husney, Prince’s first manager, who now lives in Los Angeles.

It was as if no one had truly grieved since Prince’s death on April 21 of an accidental overdose of the painkiller fentanyl.

On Thursday, the Revolution was tentative. They hadn’t performed together since 2012, at a benefit for the American Heart Association after Revolution drummer Bobby Z had suffered a near-fatal heart attack.

The stumbling block on opening night was emotions. Melvoin, the spokesperson and principal lead singer, seemed spent and dispirited. Sadness permeated the performance. There was a hole in the musicians’ hearts — and in the middle of the stage.

The band loosened up on Friday. Then on the third night, Melvoin was all smiles from the get-go. Not that she completely made the transition to frontwoman.

This was a group of musicians trained by the master to be in the background, not the spotlight. That was obvious when special guests Bilal (on the first two nights) and Kimbra (on the final gig) took center stage. These mononymous singers commanded the stage like stars.

Bilal, 37, a Philadelphia soul man, was beautiful on “The Beautiful Ones.” Kimbra, 26, a New Zealander with a big pop voice, was striking in her Princely black-and-white outfit and silver platform shoes with 6-inch heels, but her performance was over the top on “Private Joy.” Having her sing “Delirious” was apropos because her manner reflected the song’s title.

The set list was identical for the first two concerts but “Delirious” and “When U Were Mine,” a buoyant triumph featuring early Prince sidemen André Cymone and Dez Dickerson, were added for the third gig.

One of the unsung heroes of this Revolution reunion was lighting director Roy Bennett. He started with Prince on the Dirty Mind Tour in 1980. Like Prince, he’s worked his way to the top of the business. This year, he designed for tours by Beyoncé, the Cure and Paul McCartney. Bennett lit First Avenue like it was an arena, giving the Revolution an opportunity to look grand.

Other names from Prince’s past showed up. Apollonia, his co-star from “Purple Rain,” appeared every night to give a little speech and toss gold hoop earrings to the crowd. On opening night for “Baby, I’m a Star,” she joined Prince’s former wives, Mayte (who led a belly-dancing class in Minneapolis on Friday) and Manuela Testolini; former fiancée and Family singer Susannah Melvoin (Wendy’s twin), and Prince’s stylish brother Omarr Baker.

“This felt like a family reunion,” said superfan Heather Mann, 37, of Boulder, Colo., who had seen more than 100 Prince concerts since 1995.

“This makes such a natural connection with the fans,” observed Ben Margolin, a San Francisco software engineer who runs the highly regarded fan site

Backstage on Saturday, after the shows were over, drummer Bobby Z, the chief organizer of this reunion, looked more exhausted than elated.

“This really makes people happy,” he said, not looking the least bit happy. “It’s impossible to explain.”

Bassist Mark Brown looked relieved, offering a hint of a smile. “We grieved, we cried together. Now we can move on,” he said.

He hinted that maybe the Revolution would consider a tour in 2017. He was uncertain if the band would participate in the official Prince tribute being organized by his estate for U.S. Bank Stadium on Oct. 13.

This historic Revolution reunion caught the attention of the music world. Rolling Stone and the New York Times reviewed opening night. Rudolph, who has a Prince tribute band called Princess, flew in, as did Britt Daniel from the indie rock band Spoon of Austin, Texas.

Prince fanatic Questlove, drummer for the Roots and “The Tonight Show with Jimmy Fallon,” arrived for the final two nights to spin Purple sounds before and after the concerts.

The Struts, a British rock band playing at State Fair, headed over to First Avenue on Saturday to see the Revolution instead of staying to watch Weezer, the group they opened for at the fair.

Whether famous or just fans, they came to hear the music of Prince in the club that he made internationally famous. Part wake and part concerts, the three evenings underscored the obvious.

Prince is gone. Neither he nor his music will be forgotten. But, more than four months after his passing, it’s still hard to comprehend.

“I’ll miss him forever. There will never be closure for me,” said Z. “There is a hole in the middle.”