A 20-year-old man was charged Sunday in the beating death of his 3-year-old stepdaughter over the weekend in Brooklyn, police said.

Kelsey Smith allegedly beat Jeida Torres after he got enraged over her soiling herself while he was baby-sitting her at about 3:50 p.m. on Saturday, a law enforcement official with knowledge of the incident said.

Jeida’s 5-year-old brother, Andrew, was beaten when he tried to intervene, Brooklyn Borough President Eric Adams said in a statement.

The children lived with the mother and Smith, who were recently married, in a second-floor Bushwick apartment inside a homeless shelter, police said.

Smith was charged with felony assault and acting in a manor injurious to a child in the beating of Jeida, police said. He was not charged with murder because the medical examiner had not yet ruled if her death was a homicide.

Smith was not charged in Andrew’s beating, but police said the case was still open and more charges could be pending.

Smith could not be reached for comment and it could not be determined if he had retained an attorney.

Both children were taken to Wyckoff Hospital Medical Center where Jeida was pronounced dead and Andrew was listed in stable condition, police said.

Smith allegedly fled the apartment but was picked up inside a relative’s home in Queens, the law enforcement official said. He was taken to Elmhurst Hospital Center suffering from self-inflicted wounds.

Adams called on the Department of Homeless Services Sunday to complete a full investigation into Jeida’s death and how the agency handles domestic violence cases in all shelters.

“The death of a child is a very tragic incident,” Camille Rivera, deputy commissioner for DHS, said in a statement. “We are working closely with other city agencies to determine how this occurred. We will continue to do everything possible to ensure the safety of all children who are in our shelters.”