Eight days before a 14-year-old boy allegedly shot and killed his 9-year-old brother in Mattapan, a social worker with the state Department of Children and Families, which wanted custody of the older boy, visited the home, state officials said today.

Governor Deval Patrick this afternoon disclosed the DCF contact with the Mattapan family during comments to reporters at the State House. Health and Human Services Secretary John Polanowicz, who oversees DCF, provided some details of the late January visit.

“The department did all the right things in this, and we just have an incredibly tragic outcome,’’ Polanowicz said.

Advertisement - Continue Reading Below

Boston police identified the victim today as Jan Marcos Pena; the older brother’s name has not been released.

Polanowicz said DCF was “more than responsive” in trying to help the family. He said the elder sibling was in a 45-day residential program, known as STARRS, that is designed to help stabilize troubled teens. He also said DCF officials made multiple home visits and tried to take custody of the teen late last year.

When the state was not granted custody of the child, the social worker continued to make visits to the family’s home, Polanowicz said. The last visit, he said, was on Jan. 30.

The worker who tried to help the family “is shattered that this happened on his watch, and was almost inconsolable when he found out,” Polanowicz said.

The comments by the Patrick administration officials came a few hours after the teenager was ordered held on $50,000 bail today during a closed-door hearing in Dorchester Juvenile Court, officials said.

“He’s very scared. He’s very heartbroken,’’ said the boy’s defense lawyer, Michael Doolin.

Doolin added, “He comes from a family who cares very much about him. We look forward to litigating this case in court over the next several months. I ask that you respect the privacy of the family at this time. A mother is very, very broken-hearted, a family that has just been devastated by this tragic, tragic set of circumstances.’’

Doolin, who spoke briefly to reporters after the hearing, did not respond when asked where the teenager had gotten the gun that killed his brother.

About a dozen people were in the courthouse on behalf of the 14-year-old, including the mother of both boys. None of the spectators would talk with the crowd of reporters who gathered outside the Washington Street courthouse.

The boys’ aunt told the Globe today that the mother had stepped out of her second-floor apartment so she could warm up the family van. She was about to depart with her oldest child, whom she was trying to get into an alternative school, the aunt said.

“He’s a really good child and smart,’’ the aunt said of the 14-year-old. “That’s all we want to say.”

The aunt, who asked not to be identified by name, said the mother was devoted to all of her children, which also includes a teenage daughter.

Juvenile Court Judge Leslie Harris set the bail for the juvenile, who is charged with involuntary manslaughter and illegal gun possession, Suffolk District Attorney Daniel F. Conley’s office said. Another hearing was set for March 3.

The 14-year-old wore sweats and a shirt as he listened to the court proceedings, which were closed to the media and other members of the public. Juvenile court proceedings are closed.

In May, the teenager was sent to a program in Norwood aimed at helping adolescents struggling in their family home, a program known by the acronym of STARR, officials said. It was not immediately clear this afternoon if the Norwood placement in May was the program that Polanowicz was referring to in his comments.

STARR is a Department of Children and Families-funded program meaning “stabilization, assessment and rapid-reintegration,” designed to give the teen and families a respite for up to 45 days while a longer-range solution for the problems causing family turmoil is created, according to the DCF website.

The STARR program in Norwood is operated by the Home for Little Wanderers, whose officials today declined to discuss their involvement with the teenager, citing the federal privacy act for patients known as Health Insurance Portability and Accountability Act or HIPPA.

According to Norwood police, staff at the Norwood facility contacted them at 3:19 p.m. on May 7, 2013, to report that the teenager had left the program. According to the police, staff reported the teen had arrived earlier in the afternoon on May 7, and was gone a short time later.

Norwood police reached out to those listed as contacts for the teen, but did not locate the boy on May 7, according to Norwood police. Boston police notified Norwood police on May 10 that the teenager had been located, Norwood police said.

Speaking in general terms, Home for Little Wanderers officials said that the only way for children to be sent to the program is by the DCF. The officials also said that staffers do not have authority to physically restrain clients, and that the Norwood facility does not have locked doors or barriers to clients leaving.

“We are not going to stop, physically, a child from running,’’ said Home official Lesli Suggs.“We are not allowed to stop them, a child from running, by putting hands on’’ the children. “But we certainly would call the police and call whoever had [legal] custody of that child.’’

Boston public schools spokesman Brian Ballou said counselors were at the James W. Hennigan Elementary School in Jamaica Plain today, the school attended by Pena. He also said the principal at the Hennigan is talking with the teacher of the young boy’s class to figure out the best way to offer support to his classmates.

“This is a terrible tragedy and we are focused on supporting this family and the school as best we can. At this very moment, hundreds of other parents in our community are also struggling with issues of gun violence and child safety. We all must do more to help them. We are looking at every aspect of this situation because it will offer many lessons about how our community should strengthen coordination to better support any family in crisis,” the school department said in a statement.

Police responded to the home in the 600 block of Morton Street at about 11:37 a.m. on Friday, police said. They found Pena suffering from an apparent gunshot wound.

The boy’s death alarmed and outraged neighbors and prompted a plea from Boston Mayor Martin Walsh for a gun buyback program.

The boy was shot in the chest and rushed to Boston Medical Center, where he was pronounced dead.