A Brooklyn teenager has been arrested as the rooftop sniper responsible for fatally shooting the Brooklyn mother as she saved school kids, scared to death from flying bullets, police said.

Gang member Andrew Lopez, 18, allegedly confessed to the killing after his arrest, reportedly admitting he pulled the trigger last Friday afternoon on a Brooklyn street packed with children.

The slender shooter confessed the gunfire was sparked by a turf war between two Brooklyn gangs. An 11-year-old girl and another school mom were wounded by the wild-shooting sniper.

In his confession, Lopez reportedly told cops that “he did not mean to shoot the ladies.”

He was charged with murder, two counts of assault, reckless endangerment and weapons possession.

Zurana Horton, 34, was shot in the chest after springing forward to protect the nearby kids when the gunshots started Friday afternoon near Public School 298 in Brownsville.

Witnesses said the mother was seen using her body as a shield for several children before she was hit with the fatal bullet.

Lopez told cops he was targeting rival gang members when a bullet slammed into Horton, who was picking up her children after school.

Arrested along with Andrew Lopez were his half-brother, 17-year-old Kristian, and 22-year-old Jonathan Carrasquillo.

The three lived in a fifth-floor apartment inside the building at 1800 Pitkin Ave., where the gunman opened fire from the roof, police said.

Andrew Lopez had a previous arrest for walking down Pitkin Ave. while toting a loaded rifle three years ago, police said.

The slaying left parents and children running for their lives just one block from the school on Friday. The slain woman was planning to marry her jailed boyfriend on Valentine’s Day next year.