MANCHESTER, N.H. — A 54-year-old father shot his 9-year-old son dead to spite his former girlfriend, then killed himself, all in front of a social worker during a supervised visit at a YWCA yesterday, authorities said.

“There’s a lot of sadness and also anger on the part of everyone involved that a father would take his son’s life for no other reason than apparently to spite his mother,” said New Hampshire Assistant Attorney General Jeffery Strelzin.

Muni Sav­yon had made threats about a year ago to harm himself, his ex-girlfriend and their 9-year-old boy, Joshua Savyon, Strelzin said.

The social worker was not harmed during the attack, which was captured on video about ?10 a.m. after the boy’s mother had dropped him off. Strelzin said the YWCA regularly hosts supervised visits and sometimes uses a metal detector to screen parents, but did not do so yesterday. He said despite the past threats, no one suspected Savyon was capable of violence.

“From what we know right now, no one saw this coming today,” Strelzin said. “She had reservations, which is why he was having supervised visits. She wasn’t there. She dropped her son off and unfortunately his father decided to take his life.”

Strelzin confirmed that Savyon emailed a note to someone before the attack that is now being studied by investigators. He wouldn’t comment on the contents.

Rabbi Levi Krinsky of Chabad Lubavitch, who said he knew Savyon and had seen the email, said it explained what Savyon ?intended to do, and that he would be dead by the time the person read it. He declined to identify the recipient.

Ellen Vig of Billerica, Sayvon’s ex-wife — not the mother of his child — said she has a copy of the letter, written in Hebrew.

“It was his intentions. What he wanted to do with his property,” she said. “It’s a suicide note.”

Vig said Savyon had been depressed since his brother died unexpectedly in Israel six weeks ago, but she didn’t know him to be a violent person. She said Savyon was frequently in court in custody fights with his son’s mother since they split several years ago, and took those fights hard. The boy’s mother could not be reached for comment.

Krinsky said he knew Savyon was despondent over his brother’s death, but said he didn’t imagine Savyon would take this course.

“The sane mind cannot comprehend the thoughts of the ?insane mind,” Krinsky said.