Police assemble outside the YWCA in Manchester, N.H. The state attorney general's office said Muni Savyon, 54, of Manchester used a handgun to fatally shoot his son Joshua Savyon, 9, of Amherst, N.H., before fatally shooting himself during a supervised visitation in the YWCA office. An adult supervisor was present when the shootings happened. Photo: AP

MANCHESTER, N.H. — A New Hampshire software engineer shot his 9-year-old son to death before taking his own life during supervised visitation at a YWCA office, officials said Sunday.

An adult supervisor was present when Muni Savyon, 54, of Manchester, took out a handgun and shot 9-year-old Joshua Savyon of Amherst before shooting himself around 10 a.m., the attorney general’s office said.

The father sent an email to a friend suggesting he was suicidal before the shootings, said Rabbi Levi Krinsky of Chabad Lubavitch in Manchester. Krinsky said Savyon had been depressed after recently returning from his brother’s funeral in Israel but he had seen him last week and had no concerns he would harm himself or someone else.

“What would provoke him to take his life and his son’s life? I don’t think anyone can figure that out,” said Krinsky, who said Savyon attended synagogue occasionally. “My heart goes out to the family.”

On Sundays, the YWCA is open for supervised child visitation and custody exchanges. Krinsky said the man and the boy’s mother shared custody of the boy after parting ways years ago. The couple’s marital status wasn’t clear; Krinsky said the couple were divorced, but law enforcement officials said the two were separated.

Law enforcement officials said the relationship had been contentious at times and Muni Savyon had previously threatened to kill himself, his son’s mother and their son.

But Ellen Savyon Vig, who was once married to Muni Savyon and had remained friends with him after their 1997 divorce, described him as a kind-hearted person. She said he was especially close to his brother and he loved his son, trying to give him varied experiences.

“He was nonviolent. He would try to help anyone he could. He was a really nice guy,” she said from her home in North Billerica, Mass.

Savyon was active in Libertarian causes, Vig said, and was a twice-defeated candidate for the New Hampshire Legislature, most recently in February.

“Please keep the Savyon family in your thoughts and prayers as they cope with the unimaginable,” Rep. Peter King, who easily beat Savyon in a special election for the New Hampshire House, said from his Twitter account.

Born in Israel, Savyon was a naturalized citizen who lived in several Western states before coming to New England, where he worked as a software engineer, Vig said.

Others were inside the YWCA building when the shots were fired partway through the one-hour visitation. The counselor who was present at the time managed to escape unarmed, officials said.

The YWCA USA offered its “thoughts and prayers” for the families and friends of the victims. CEO Dara Richardson-Heron said the tragedy reminds the national organization of how important its domestic violence services are.

“We are deeply saddened by the tragic loss of life that occurred at the YWCA New Hampshire today,” Richardson-Heron said in a statement Sunday night.

Autopsies were scheduled for Monday.

Krinsky said he had no idea that Savyon was capable of violence, much less harming his own son. “We have to be more and more alert to mental illness and people who’re depressed,” he said.