Vice President-elect Mike Pence, top center, leaves the Richard Rodgers Theatre after a performance of "Hamilton," in New York on Nov. 18. (Andres Kudacki/AP)

They knew ahead of time that Vice President-elect Mike Pence would be in the theater that night. So the cast of the Broadway musical “Hamilton” reportedly gathered at the Richard Rodgers Theatre in New York half an hour before the curtain rose Friday evening.

According to an account in Broadway.com, the cast dialed up Lin-Manuel Miranda, the show’s writer and creator, and Jeffrey Seller, the producer, and together they crafted a message encouraging the incoming administration to uphold America’s values on behalf of people of different backgrounds, beliefs and orientations.

The audience, however, did not know Pence was there until just moments before the curtain rose. Some speculated a VIP would be in attendance: As theater-goers arrived, they saw black Suburbans, Secret Service and an ambulance clogging the street outside. As they sat in their seats and waited in line for the bathroom, they speculated whether the VIP would be President-elect Donald Trump, or maybe first lady Michelle Obama, for a repeat performance.

Most of the audience members were in their red velvet seats when Pence entered the theater. He was greeted with loud boos, a smattering of cheers, and the flash of cellphone cameras. He waved as he walked to his seat in the orchestra section, Row F.

Police stand guard Friday as a motorcade carrying Vice President-elect Mike Pence leaves the Richard Rodgers Theatre in New York. (Andres Kudacki/AP)

Shannon Stagman, 32, a researcher for an education nonprofit organization in Brooklyn who was seated in the mezzanine, said she heard the crowd’s reaction work its way up the theater after the audience spotted Pence. “From my vantage point, it sounded like the entire theater was booing,” Stagman said.

Christy Colburn, 43, of Boston, bought tickets to the musical as a Valentine’s Day gift for her husband. She ended up sitting about 20 seats away from the vice president-elect, she said.

“It was a mixed response, but it was overwhelmingly boos,” she said. “People kept booing after he sat down; it was almost uncomfortable. He smiled, and some people took his picture. He didn’t seem that fazed by it.”

“Hamilton,” a Broadway musical that has won 11 Tonys, usually provokes a loud and joyous reaction from its crowds. But that night, the reaction was heightened. “This particular show, there are a lot of scenes that are very antithetical to the ideas of the Trump-Pence campaign that they’ve been running on. So I think that was resonating with people, knowing he was in the room,” Stagman said.

The musical chronicles Alexander Hamilton’s roots as an orphan and immigrant, his rise to prominence via the war, and his contentious participation in the formation of the American government. It is noted for featuring a multicultural cast. The actor who currently stars as Alexander Hamilton, Javier Muñoz, is Latino and openly gay. And Friday evening also sought to raise money for AIDS-
related services as part of the annual Broadway Cares campaign.

Theater and the arts have long been havens for members of the LGBT community, which has been vocal in condemning Pence’s apparent past support of conversion therapy for gay people.

The cast of "Hamilton" delivered a message to Vice President-elect Mike Pence from stage after he watched the show at Richard Rodgers Theatre in New York on Nov. 18. Pence was booed by some audience members when he first walked in. (Twitter/Hamilton via Storyful)

The LGBT community and nonprofit groups such as the Human Rights Campaign have criticized Pence for signing a law as governor of Indiana that allowed business owners to decline to participate in same-sex weddings because of their religious beliefs. Pence later signed an amendment clarifying that the provision could not be used to discriminate based on sexual orientation, and he has not said that he will roll back gay rights under the new administration.

Stagman said she had headed to the theater that night in search of a few hours of diversion. “I was definitely looking forward to going to Hamilton as kind of an escape, to get away for a few hours from our current reality.” Instead, she was thrown into an unusual political experience, as the crowd clapped, hooted and hollered at the parts of the show that seemed to apply to Pence and President-elect Donald Trump’s political agenda.

A song sung by King George III particularly resonated with the crowd. During the song “What Comes Next?” in which the character of King George III admonishes America of the challenges of ruling itself. During the stanza, actor Rory O’Malley paused several times as people cheered and shouted, as he sang lines like “Do you know how hard it is to lead?” and “When your people say they hate you/ Don’t come crawling back to me.”

But the biggest crowd reaction came to the words of the chorus jointly sung by Alexander Hamilton and the Marquis di Lafayette regarding the war: “Immigrants, we get the job done.” The audience rose to its feet to give a standing ovation.

“I’ve seen the show three times, it’s always a big applause line, but the reaction last night was insane,” said Stagman.

Pence left just before intermission, and he returned to his seat after the lights were down.

The cast had known ahead of time that Pence was coming. Pence contacted the owner of the theater, the Nederlander Organization, to request several “house seats” from a reserve that is set aside for “special guests and urgent last-minute needs,” show spokesman Sam Rudy said. Pence paid for his tickets, although Rudy declined to say whether Pence paid face value or how many people were in his party. The Nederlander Organization notified the cast, crew and producers in advance of Pence’s attendance.

As the show ended and the cast took a bow amid a standing ovation, Pence was already on his feet. Secret Service was ushering him out the exit when Brandon Victor Dixon, who plays Aaron Burr, stepped forward to address him.

“You know, we have a guest in the audience this evening,” he said to audience hoots and laughter. “And Vice President-elect Pence, I see you walking out, but I hope you will hear us just a few more moments. There’s nothing to boo here, ladies and gentlemen. There’s nothing to boo here. We’re all here sharing a story of love. We have a message for you, sir. We hope that you will hear us out.”

As he pulled a small piece of paper from his pocket, Dixon encouraged people to record and share what he was about to say, “because this message needs to be spread far and wide.” The cast, in their 18th-century costumes, and the crew, in jeans and T-shirts, linked arms and hands behind Dixon.

Audience members said Pence appeared to linger by the theater door, but Secret Service ushered him out. Still, he stood in the hallway to listen to the rest of Dixon’s message, Rudy confirmed.

“Vice President-elect Pence, we welcome you, and we truly thank you for joining us here at ‘Hamilton: An American Musical.’ We really do,” Dixon said to further applause. “We, sir, we are the diverse America who are alarmed and anxious that your new administration will not protect us . . .”

The crowd began to cheer, and Dixon raised a finger to silence them.

“Our planet, our children, our parents, or defend us and uphold our inalienable rights, sir. But we truly hope that this show has inspired you to uphold our American values and to work on behalf of all of us. All of us,” he said, gesturing to the crowd.

The audience erupted in cheers again. “Again, we truly thank you for sharing this show, this wonderful American story told by a diverse group of men and women of different colors, creeds and orientations.”

Stagman said that despite some booing when Pence arrived, the cast’s tone was gracious, and the vibe in the audience wasn’t negative. “It was more like, wow, that was a weird experience, and interesting that we got to be part of this moment of a group of us getting to express ourselves to elected officials, which isn’t something that most of us get to do very often.”

“We got to speak out,” she added. “I think that’s really important right now.”

As they exited the theater, audience members saw a few protesters outside. One woman held a sign reading, “Immigrants we get the job done.”

Peter Marks, Ellen McCarthy and Michael O’Sullivan contributed to this report.