The gunman who opened fire on a popular Toronto street Sunday night — killing a 10-year-old girl and an 18-year-old woman and wounding scores more — was a “kook’’ with a Batman obsession, law-enforcement sources told The Post on Monday.

“They don’t believe it’s terror,’’ a source said of the Sunday night rampage in the Canadian city’s Greektown neighborhood.

“The guy’s got a history as an EDP — he’s been an [emotionally disturbed person] since high school,’’ the source said of killer Faisal Hussain, who was born in Canada and is of Middle Eastern descent.

The suspect, 29, was known in high school for keeping pictures of people being killed, the source added. He had previously been arrested two times: once for armed robbery and another for possession of an imitation pistol, sources said.

“They’re not really leaning toward terrorism. More kook,” the source explained. “Supposedly, he had some fascination with the Batman movie ‘The Dark Knight,’ ” although it’s not clear if that had any bearing on the shooting.

The gunman was found dead in a nearby alley following an exchange of gunfire with cops. It is unclear whether he killed himself or if the cops fatally shot him.

Authorities began receiving calls shortly after 10 p.m. in which witnesses reported seeing the dark-clad man walking down the street firing at restaurants, cafes and patios in all directions.

The gunfire triggered a frantic stampede as people ran for safety.

The killer was caught on video at one point walking on the sidewalk and then turning to aim and fire at his fleeing victims.

“He had this horrible expression on his face,’’ said Andrew Mantzios, who was having coffee with pals near the scene at the time. “A lady tried to run, and she fell down. He turned around and shot her point-blank, two or three times.”

Passer-by Jo-Anne Saunders said she is still haunted by what she witnessed: a young girl getting shot while out eating ice cream with her family.

“She was across the road. There were a few ice-cream parlors there, so there was just groups of families eating ice cream,” Saunders told CBC News. “I saw her fall down, and I assumed it was a gunshot, and people were starting to fall down around her.”

Another witness added that the gunman “would zigzag across the street — he would just head for a group of people and start shooting some easy targets.”

Toronto Mayor John Tory said the attack is “evidence of a gun problem” in the city.

“Guns are too readily available to too many people,” Tory told reporters.

Prime Minister Justin Trudeau wrote in a tweet, “My thoughts are with everyone affected by the terrible tragedy . . . The people of Toronto are strong, resilient and brave – and we’ll be there to support you through this difficult time.”