A suspect was in custody on Friday for allegedly scrawling “Kill all Jews” inside a historic Brooklyn synagogue, sources said.

James Polite, 26, allegedly scrawled the anti-Semitic graffiti in the stairwell of Union Temple in Prospect Heights on Thursday night, according to law enforcement sources.

The vile message was discovered prior to a political event hosted by “Broad City” star Ilana Glazer. The event was canceled out of safety concerns.

The vandalism came five days after a mass shooting at a Pittsburgh synagogue, where the gunman yelled “All Jews must die!”

Sources said the man was also caught on surveillance earlier Friday setting a rubbish fire at a second synagogue in Williamsburg. He was wearing the same jacket during both acts of vandalism.

The suspect was being treated at Woodhull Hospital for unknown reasons on Friday night.

The suspect was being held under psychiatric evaluation at Woodhull Hospital Friday night.

Both incidents are being treated as hate crimes.