The son of the Bay State’s chief appeals court judge was arrested for a hate crime after he and another freshman spray-painted a chapel at Northwestern University with racist, anti-Semitic and homophobic graffiti, as well as the word “Trump.”

Matthew Kafker — son of chief of the Massachusetts Appeals Court Scott L. Kafker — and Anthony Morales, 19, wrote and recorded a statement admitting their role in the vandalism to university police, Illinois prosecutors said.

Governor Charlie Baker appointed the elder Kafker to the court last year. His office called the actions “despicable.”

“The governor was shocked to hear of these reports and he believes there is absolutely no place in society for this type of despicable behavior,” his communications director Tim Buckley said.

“I spoke with Chief Justice Kafker, and he respectfully declined comment,” Jennifer Donahue, spokeswoman for the Massachusetts Supreme Judicial Court, said this morning.

Matthew Kafker and Morales were charged with institutional vandalism, hate crime to a place of worship, and criminal damage to property.

“These allegations are disgusting to me,” Judge Peggy Chiampas said as she addressed Kafker, 18, and Morales, her voice rising several times during a Saturday bond hearing at the Leighton Criminal Court Building.

The defendants said nothing during the hearing.

Both were released on $5,000 bond, the Cook County Sheriff’s Office told the Herald in a statement.

“On behalf of the entire Northwestern community, I express our shock and dismay at the abhorrent act of vandalism committed … in Alice Millar Chapel in which racist, anti-Semitic, homophobic and other offensive graffiti was spray-painted on walls, offices and even the organ,” university president Morton Schapiro said in a statement. This disgusting act of hatred violates the deepest values and core commitments of our University and is an affront to us all.”

Schapiro said the students have been placed on interim suspension, which prohibits them from being on campus.

Kafker and Miller were captured on video entering the nondenominational chapel at 12:45 a.m. on Friday and arrested by university police.

Once inside, the pair spray-painted an expletive and a slur against African-Americans with a swastika on the chapel hallway, Assistant Cook County State’s Attorney Brooke Shupe told the court.

In a separate area, they spray-painted a derogatory word for homosexuals on a wall, along with lines spray-painted over photos of Muslim students, the prosecutor said.

The young men also spray-painted penises in several places around the church, including on a piano in the chapel, above the word “God” in a hallway, and in a stairwell where they also painted the word “Trump,” authorities said, Shupe said.

Prosecutors did not say what they think sparked the act of vandalism.

Herald wire services contributed to this report.