Lin-Manuel Miranda on ‘Brooklyn Nine-Nine’

Lin-Manuel Miranda

Tyler Golden/NBC Lin-Manuel Miranda hits the streets with the Nine-Nine crew guest-starring as Amy Santiago's brother.

Great news, Squad! NBC recently renewed Brooklyn Nine-Nine for a seventh season! What some more great news? Hamilton maestro Lin-Manuel Miranda is guest-starring on tonight’s episode! (It’s a great year to be a fan of almost-canceled cop comedies.)

In the episode titled “The Golden Child,” Miranda, who recently starred in Mary Poppins Returns, plays David Santiago, brother of Amy (Melissa Fumero) and also her rival. Miranda was one of the first celebrities to tweet his support for the beloved comedy right after its cancelation by Fox last year. NBC reacted fast and picked the show up for a 13-episode sixth season, and later added five more episodes to their order.

“I have literally been pitching Lin as a brother I think since, like, season 1 when he first tweeted about the show,” Fumero told EW’s Best of Shows podcast. “Hamilton hadn’t come out yet. But I am a huge fan of In the Heights so I was like, ‘Oh my God, Lin-Manuel Miranda loves the show!’ and people were like, ‘Who dat?’ And then Hamilton came out and everybody knew who he was.”

According to Fumero, Miranda started to “geek out” when he arrived on the set.

“It was so weird for everyone. He was like making up songs about, ‘I’m on my favorite show, I’m inside my faaa-vorite show!’ And we were like, ‘No, you don’t get to geek out—we all get to geek out.’”

As for his character, Fumero said he’s “such a Santiago,” and that Miranda based his character off of Amy.

Miranda joined Mark Hamill, Sean Astin, and Patton Oswalt (who previously appeared on the series) in supporting the show after its apparent demise. Co-creator Dan Goor told EW in May of last year that he’d love to incorporate some of the show’s more famous fans. “We’re huge fans of all of those actors. And we’d love to try to figure out ways to put them on our world.”

Miranda is friends with Fumero and the Broadway star even celebrated with the cast following NBC’s surprise Nine-Nine rescue.

Miranda guest-starred in the last season of Curb Your Enthusiasm and also lent his voice to three episodes of Disney’s DuckTales reboot. He recently reprised his lead role in Hamilton for a three-week stint in Puerto Rico to raise money for struggling artists in the aftermath of Hurricane Maria.

Nine-Nine had a solid start for its sixth season in January when it averaged a 1.4 rating in the key 18-to-49-year old demo while earning 3.9 million viewers in Live+7. Last year, the show averaged 2.9 million viewers on Fox at the same point in the season.

In other Nine-Nine news, most fans are already missing Chelsea Peretti’s Gina Linetti since her exit, but she’s returning later this season in an episode called “Return of the King”—an episode that Fumero herself directed.

“We get to see Gina again and we get to see what she’s doing,” said Fumero. “Her new life has sort of exploded, and it’s very exciting, it’s very funny, and it’s very Gina.”

Brooklyn Nine-Nine airs Thursday nights at 9 p.m. ET on NBC.