A man who posted misogynistic comments online and had a history of arrests for harassing women allegedly opened fire inside a Florida yoga studio late Friday, killing two women, injuring four others and pistol-whipping a man who tried to stop him before turning the gun on himself.

The gunman, identified as 40-year-old Scott Paul Beierle, posed as a customer to gain entry to Hot Yoga Tallahassee and then “began shooting patrons with a handgun without warning,” police said in a statement. He reportedly shot one woman nine times, though she survived, along with four others wounded in the course of the rampage.

The shooting sparked panic in the small shopping center where it occurred, with patrons at a neighboring bar rushing for the exits and huddling together out of fear the gunman was on a rampage. Instead, one of the victims of the attack in the yoga studio is believed to have stopped Beierle from harming more victims.

Kristin Jacobs, a Parkland representative in the state Legislature, told the Tallahassee Democrat she was in the bar near the yoga studio when a man covered in blood and several women came rushing in. The man, who has not been named, said the only reason he’d survived was because he rushed the gunman. The shooter pistol-whipped him but then turned the gun on himself, Jacobs recalled him saying.

“Many people are alive because this guy rushed the shooter. I am alive because one guy in a yoga class in his bare feet ran at a shooter,” Jacobs said.

It remains unclear why Beierle targeted the yoga studio or if he knew his alleged victims. Police said Saturday that he was a resident of Deltona, a city located about four hours away from Tallahassee.

Tallahassee Police Chief Michael DeLeo said investigators are still working to determine “what made him come to our community and commit this heinous act here.”

“ Many people are alive because this guy rushed the shooter. I am alive because one guy in a yoga class in his bare feet ran at a shooter. ” — Kristin Jacobs, a representative in the state Legislature

Beierle’s LinkedIn profile described him as a “job seeker” since 2013. He did a two-year stint with the U.S. Army starting in 2008, according to his profile, and from 2011 to 2013 attended Florida State University—where the two women he allegedly killed studied and worked.

Dr. Nancy Van Vessem, 61, and Maura Binkley, 21 died of their injuries on Friday night, police said. Binkley was a student at Florida State University, while Van Vessem was a faculty member, according to a statement from the university. Van Vessem also served as chief medical director of Capital Health Plan.

It was not immediately clear if Beierle ever crossed paths with Van Vessem or Binkley while at Florida State University.

But Leon County court records show that Beierle had a handful of prior arrests for allegedly grabbing women, and in one case, the alleged groping occurred at the university. In 2012, Beierle was arrested on misdemeanor battery charges after allegedly grabbing a woman’s buttocks in a popular dining hall on the FSU campus.

Another woman told police she’d witnessed the incident and that “the same person has (grabbed) her on the buttocks on three separate occasions over the last month,” according to court documents cited by the Tallahassee Democrat.

He was later banned from FSU and charged with trespassing after being spotted following a volleyball coach on campus in 2014, according to court records.

Beierle was arrested again in 2016 on similar charges after another woman accused him of slapping and grabbing her buttocks near the swimming pool of an apartment complex where he lived. Prosecutors ultimately dropped the charges against Beierle in both cases.

Tallahassee police did not immediately respond to an inquiry on whether Van Vessem and Binkley had any involvement in Beierle’s previous arrests.

Beierle also reportedly posted misogynistic YouTube videos and Soundcloud songs before the shooting. According to BuzzFeed News, he posted videos calling women “sluts” and “whores” for their supposed “treachery” and “lying.”

In one video titled “Plight of the Adolescent Male,” he reportedly likened himself to Elliot Rodger, the California university student who gunned down six people after posting a video lamenting the “hot, beautiful blonde girls” who were not paying attention to him.

On Soundcloud, Beierle also agonized over his inability to get female attention, and in one song, described chaining up a woman in his basement so he could rape her.

Beierle's YouTube account has since been terminated.

Tallahassee Mayor Andrew Gillum, who was on the final leg of his Democratic gubernatorial campaign just days before midterm elections, canceled his campaign events and returned to Tallahassee on Saturday in the wake of the shooting.

“It reminds us that these occurrences are far too frequent and often times render us speechless as we try to figure out what’s going on, what happened, and why,” Gillum told reporters. He had reportedly left a prayer session in South Florida honoring the 11 people killed just one week ago in Pittsburgh’s fatal shooting to deal with the aftermath of this latest rampage.