NEW YORK (CBSNewYork) – The NYPD says a man is in custody after anti-Semitic graffiti was found inside a Brooklyn synagogue Thursday, ahead of a planned political event hosted by “Broad City” star Ilana Glazer.

26-year-old James Polite, of Brooklyn, allegedly wrote several hate words in black marker inside Union Temple in Prospect Heights, according to police. The suspect also drew a picture of the Puerto Rican flag and wrote “Free P.R.”

Mayor Bill de Blasio called the hateful messages “tremendously upsetting.”

“Coming at a time when Jewish New Yorkers are feeling a profound sense of loss and sadness because of what happened at the Pittsburgh Tree of Life synagogue and all those who were killed there because of their faith,” he said outside Union Temple late Friday, where security guards and NYPD officers patrolled as congregants stood up to fear.

The vandalism came less than a week after 11 people were shot and killed inside a Pittsburgh synagogue in the deadliest attack on Jews in U.S. history.

“I got back from Pittsburgh on Wednesday after visiting the community there and seeing really the utter brokenness of that community and what they’re going through. And then to come back here and to feel unsafe here is really concerning,” said Rabbi Jon Leener.

Before the arrest, NYPD Chief of Detectives Dermot Shea revealed that police were looking for a man caught on surveillance cameras at the temple. He was seen wearing a red suit jacket and using a black marker to write messages of hate throughout the building before fleeing.

Police say Polite was seen wearing a red suit jacket and using a black marker to write messages of hate throughout the building before fleeing. 

Once the graffiti was discovered, organizers decided to prioritize safety and cancel the event. A preschool that operates in the build was also closed Friday.

“I’m just horrified. I work at the school here, the preschool. There’s little kids in the building, and it’s just, it’s so upsetting,” Janet Weeks told CBS2.

View this post on Instagram

My friends surprised me for my birthday tonight with tickets to see @ilanusglazer speak at @generatorcollective – a series of talks with activists and politicians about the importance of voting and humanizing politics. Unfortunately, after waiting for over an hour to enter the auditorium, we were notified that some emboldened bigot had covered the walls of the Jewish temple that was housing the event with anti-Semitic symbols and slurs. Organizers felt unsafe and uncomfortable carrying on with the event, and rightfully shut it down. THIS IS WHY WE NEED TO ELECT GOOD PEOPLE INTO OFFICE. This is why we gathered tonight. This is why we protest and demand real, direct action against acts of hate and violence. Thank you to the ever-badass @ilanusglazer and Amy Goodman of @democracynow for putting these kinds of events together and staying strong in the face of incredible intolerance. We will not be stopped or silenced. Your hate has no place in this country. ✊🏽 #VOTE

A post shared by Shelby Quackenbush (@shelbyyq) on

Prior to pulling the plug on the event, Glazer excitedly took to Instagram to talk about her guests.

“I’ll also be interviewing two local candidates running tight political races: Andrew Gounardes of South Brooklyn and Jim Gaughran of Long Island. They are also, they just happen to be good men, which is nice to see,” she said. “Don’t you worry, we will be hooking you up with volunteering canvassing opportunities this weekend.”

She later told attendees not to be fearful.

“We’ll have more events soon. Thank you for coming and caring,” she said. “This is action in itself, gathering. And we’ll follow up with more, you know, specific action.”

Gounardes released a statement, which read in part, “Tonight’s attack, right here in a temple in Brooklyn–is a painful reminder that anti-semitism and prejudice are alive and well in our own community. I commend the NYPD for their quick response and believe whoever committed this hate crime should be prosecuted to the fullest extent of the law. Now more than ever, we have an obligation to reaffirm our commitment to tolerance and send a clear message that any individual or group who promotes violence and hate is not welcome in our City.”

Gaughran also spoke out against the slurs during a Friday morning rally.

“This is a hate crime, and I think it was important that they cancelled the event so that we make sure everybody was protected,” he said.

The NYPD has increased patrols at the synagogue and other places of worship. Synagogue leaders say Shabbat services will go on Friday night and Saturday morning.

Sources tell CBS2 Polite could be behind a series of fires at other shuls and yeshivas in the area. He was charged with criminal mischief, hate crime, and making graffiti in connection to the messages scrawled at Union Temple. He remained in police custody at Woodhull Hospital, where he was receiving a psychiatric evaluation late Friday.