(CNN) At the first gunshot, people dancing and having a good time at the Borderline Bar & Grill in Thousand Oaks, California, tried to process the pop they just heard.

The pops kept coming and many in the place dived to the floor, searching for a way out. Some people moved to put themselves between the shooter and his potential targets.

Teylor Whittler, a California Lutheran University student, said there was little screaming, just gunfire and a stampede of people.

"There were at least 50 people that all tried getting up at once and run out the back door. I ended up getting caught in the ground and stumbled over by multiple people," Whittler told CNN affiliate KABC . "Everyone just yelled, 'Run, he's coming!'"

The gunman, a US Marines veteran, arrived at the bar on Wednesday night with a pistol, officials said. He shot an unarmed security guard outside the bar, then went in and continued shooting, injuring other security workers, employees and patrons, Ventura County Sheriff Geoff Dean said. Ian David Long , killed 12 people before apparently taking his own life.

"It's a horrific scene in there," the sheriff told reporters at a media briefing. "There is blood everywhere and the suspect is part of that."

Slain sheriff's Sgt. Ron Helus was planning to retire next year.

The casualties included a veteran sheriff's deputy who was nearby talking to his wife on the phone when the call came over the radio for an active shooter.

"(The deputy said), 'Hey, I have to handle a call. I love you, I'll talk to you later,' " the sheriff said.

Sgt. Ron Helus rushed into the bar as gunshots continued; he was killed.

Investigators believe Long, 28, used a legally purchased .45-caliber Glock 21 with an extended magazine during the shooting, and they're trying to figure out why he did it.

"We have no idea what the motive was at this point," Dean said Thursday afternoon.

Authorities have identified a Facebook post believed to have been made by the shooter around the time of the attack, according to a law enforcement official familiar with the ongoing investigation.

In it, the writer says: "I hope people call me insane... (laughing emojis).. wouldn't that just be a big ball of irony? Yeah.. I'm insane, but the only thing you people do after these shootings is 'hopes and prayers'.. or 'keep you in my thoughts'... every time... and wonder why these keep happening..."

When CNN read the post to a friend of Long's, who did not want to be publicly identified, the friend said, "That does not sound like Ian to me at all. I don't know what was going through his head when he wrote this. It must have been terrible."

Dance floor packed when shooting inside started

The shooting broke out during the Western-style bar's weekly line dancing and college night open to people 18 and older. People dropped to the floor and hid behind barstools in stunned silence, witnesses said. Others jumped over chairs and broke windows to get out.

Sarah Rose DeSon told CNN's "Anderson Cooper 360˚" that her friend Cody Coffman saved her life. DeSon said she was paralyzed by fear as she saw the gunman pointing his gun.

Coffman told her to get down.

"I didn't know what to do and I just followed him. I dropped down and I hid with him," she said, until he got her to run when the shooter moved away from them. She fled out the front door, but her friend died inside.

Taylor Von Molt, 21, said she was dancing when she "heard what I thought was a balloon pop."

"I heard it a couple more times, and I turned around and I saw him (the gunman)," she said. "He had ... what looked like a bandanna on the bottom on his face, sunglasses, black hoodie, dark jeans."

About 21 others were injured, many trying to escape, the sheriff's office said.

Six off-duty law enforcement officers were in the bar when the shooting happened, Dean said. Officials said they were unharmed.

A woman whose daughter was at the bar said one of those officers "stood in front of her daughter, protecting her life with his own," Ventura County sheriff's Senior Deputy Julie Novak told CNN affiliate KCAL/KCBS

Whittler told KABC that several men were in position to block the shooter "ready to take a bullet for every single one of us."

Witnesses described a man clothed in black and wearing glasses as he walked onto the dance floor filled with people and began shooting.

Photos: In photos: Mass shooting at California bar Molly Esterline is hugged by David Crawford on the scene of a shooting at a bar in Thousand Oaks, California, on Thursday, November 8. Hide Caption 1 of 24 Photos: In photos: Mass shooting at California bar People stand in a parking lot along South Moorpark Road in Thousand Oaks in the aftermath of the shooting. Hide Caption 2 of 24 Photos: In photos: Mass shooting at California bar Investigators huddle at the command post near the bar. Hide Caption 3 of 24 Photos: In photos: Mass shooting at California bar Nellie Wong cries as Chyann Worrell holds her and Erika Sigman, right, stands beside them. All three were inside the Borderline Bar and Grill when shooting started. Hide Caption 4 of 24 Photos: In photos: Mass shooting at California bar Police work outside the venue where the shooting occurred. Hide Caption 5 of 24 Photos: In photos: Mass shooting at California bar Tim Dominguez, who was in the bar with his son, sits distraught under a freeway overpass near the crime scene in Thousand Oaks. Hide Caption 6 of 24 Photos: In photos: Mass shooting at California bar Holden Harrah, 21, right, hugs family and friends after witnessing the shooting. Hide Caption 7 of 24 Photos: In photos: Mass shooting at California bar A forensics team collects evidence at the scene. Hide Caption 8 of 24 Photos: In photos: Mass shooting at California bar An American Red Cross Disaster Relief vehicle is seen outside the Thousands Oaks Teen Center where people have come for family assistance following the bar shooting. Hide Caption 9 of 24 Photos: In photos: Mass shooting at California bar Law enforcement officers guard the road leading to the Borderline Bar and Grill. Hide Caption 10 of 24 Photos: In photos: Mass shooting at California bar People comfort each other near the scene of a mass shooting at the Borderline Bar & Grill in Thousand Oaks, Californina, early Thursday, November 8. Hide Caption 11 of 24 Photos: In photos: Mass shooting at California bar Ventura County Sheriff Geoff Dean briefs reporters on the deadly shooting. Hide Caption 12 of 24 Photos: In photos: Mass shooting at California bar A woman who fled from the shooting gets hugs from relatives in Thousand Oaks. Hide Caption 13 of 24 Photos: In photos: Mass shooting at California bar An FBI agent talks to a potential witness. Hide Caption 14 of 24 Photos: In photos: Mass shooting at California bar Officers stand near a police SUV at the shooting scene in an image from aerial video. Hide Caption 15 of 24 Photos: In photos: Mass shooting at California bar Matt Wennerstorm, still wearing a blood-stained shirt, talks to members of the media outside the Borderline Bar & Grill. Hide Caption 16 of 24 Photos: In photos: Mass shooting at California bar Investigators in hazmat outfits work out of the command center at the shooting scene. Hide Caption 17 of 24 Photos: In photos: Mass shooting at California bar People comfort each other near the shooting scene. Hide Caption 18 of 24 Photos: In photos: Mass shooting at California bar Women who fled from the shooting stand by a sheriff's deputy. Hide Caption 19 of 24 Photos: In photos: Mass shooting at California bar People await news about their friends in the Borderline Bar & Grill shooting. Hide Caption 20 of 24 Photos: In photos: Mass shooting at California bar People walk away from the shooting scene. Hide Caption 21 of 24 Photos: In photos: Mass shooting at California bar Police vehicles block an intersection near the shooting in an image from aerial video. Hide Caption 22 of 24 Photos: In photos: Mass shooting at California bar Sheriff's deputies speak to a possible witness. Hide Caption 23 of 24 Photos: In photos: Mass shooting at California bar People console one another near the shooting scene. Hide Caption 24 of 24

Von Molt ran toward the nearest exit but tripped, and people kept running on top of her in a rush to escape, she said.

John Hedge, who was at the bar with his stepfather, told KABC that he hit the ground after hearing three or four popping sounds.

"I started hearing these big pops. Pop, pop, pop," he said. When he looked up, he said, he saw a security guard who had been shot.

Nick Steinwender, who is part of California Lutheran's student government, said his friends were inside the bar when the shooting started.

"It was chaos, people jumping out of windows, hopping over gates and just trying to get out," he told KABC. "From what I heard, the gunman started shooting at the front desk. ... Students were hiding in the attics, bathrooms and stuff like that."

Long had previous contacts with the law, sheriff says

Deputies were at Long's home in the Newbury Park area of Thousand Oaks on Thursday morning, seeking to serve a search warrant, Dean said. Thousand Oaks is in Ventura County , about 40 miles from downtown Los Angeles.

Long was in the US Marine Corps from August 2008 to March 2013, Defense Department records show.

Law enforcement had several previous contacts with Long, including in April when officers were called to a disturbance at his home, the sheriff said.

"He was somewhat irate, acting a little irrationally," Dean said. Mental health specialists talked to him and didn't feel he qualified to be detained under the state's "5150" mental health detention law , Dean said.

One of Long's neighbors, Tom Hansen, told KABC he had called police in April.

"I don't know exactly what he was doing -- it was like he was banging on the walls and shouting," Hansen said. "It concerned me, so I called the police."

Hansen told KABC everything seemed to go back to normal afterward and he never learned what had happened.

Long also had been a victim of battery at a different Thousand Oaks bar in January 2015, the sheriff said.

Long posted about his service with the Marines on an online forum called ShadowSpear in March 2017. He wrote he had been an infantry machine gunner, had served in Afghanistan and was an instructor in Okinawa, Japan.

Deputy killed after rushing inside

Helus, the slain sheriff's deputy, arrived at the bar three minutes after 911 calls came in, along with two California Highway Patrol officers, Dean said.

Helus went in because gunshots still were being fired, and he was shot multiple times, Dean said.

A Highway Patrol officer pulled Helus out and waited for reinforcements. When more officers arrived, they found the gunman dead inside, Dean said.

Helus died at a hospital, police said. He is survived by a wife and a son.

"I don't think there's anything more heroic than what he did," a colleague, sheriff's Sgt. Eric Buschow, said Thursday morning.

Father crushed to learn his son was killed

Some of the friends of Coffman, 22, who escaped called and woke his father around 1 a.m. to tell him they didn't know if his son had gotten out.

Just before 10 a.m., the father told reporters Cody had died.

In between sobs, Jason Coffman recounted his last conversation with Cody.

"I talked to him last night before he headed out the door. First thing I said was, 'Don't drink and drive.' "

"Last thing I said was, 'Son, I love you.' "