A mother picking up her child was shot to death across the street from a school in Brownsville, Brooklyn, on Friday afternoon as she tried to protect several children from a gunman on a rooftop who opened fire on a group of rivals on a crowded street, the police said.

An 11-year-old girl was grazed in the cheek and another woman who was also retrieving her child was hit in the arm and chest as the man fired at least a dozen shots with an automatic pistol onto Watkins Street from his perch atop a five-story building on Pitkin Avenue, the police said. The second woman, 31, was in stable condition on Friday night at Brookdale University Hospital and Medical Center.

The gunman’s spree began about 2:30 p.m., the police said, about 15 minutes after the last students were dismissed from Public School 298, at 85 Watkins Street, where about 540 children in prekindergarten through eighth grade are enrolled.

The two women, and several children, were outside Peanut Lucky Supermarket, at 112 Watkins Street, diagonally across the street from the school and about a block from where the gunman was standing atop 1800 Pitkin Avenue.