A former Marine -- armed with a Glock 21 .45-caliber handgun with an illegal extended magazine -- opened fire on a packed California country music bar Wednesday night, killing 12 people, including a veteran sheriff's sergeant nearing retirement, officials said.

Authorities believe Ian David Long eventually turned the gun on himself, but not before the 28-year-old, dressed in all black, terrorized a crowd filled with college students at Borderline Bar & Grill in Thousand Oaks, Calif. Long's body was found in an office near the entrance of the bar.

Sheriff Geoff Dean, who is set to retire on Friday, said Long may have suffered from post-traumatic stress disorder and was known to law enforcement officials due to several unspecified "contacts" stretching back multiple years. Long served in the Marine Corps from August 2008 to March 2013, with a deployment in Afghanistan between November 2010 and June 2011, military records show.

“We’ve had several contacts with Mr. Long over the years, minor events such as a traffic collision. He was a victim of a battery in a bar in 2015,” Dean said, adding that the bar in 2015 was a different establishment than Borderline.

Dean said the last interaction between Long and authorities occurred in April, when police officers were called to Long's house in Newbury Park, about five miles from Borderline, after reports of a disturbance. When they arrived, officers found Long "irate and acting irrationally," leading to a crisis intervention team being summoned. The team, however, cleared Long and said they didn't feel he was qualified to be taken into custody.

“Obviously, he had something going on in his head that would cause him to do something like this. Obviously, he had some sort of issue,” Dean said of Long.

As for why he attacked the bar, "there's no indication that he targeted the employees. We haven't found any correlation," the sheriff said. "Maybe there was a motive for this particular night, but we have no information leading to that at all."

Long opened fire inside Borderline about 11:20 p.m., during the bar's "college country night" event, authorities said. Dean said it appears Long shot the unarmed security guard first, turned to the right to shoot other security and staff members before opening fire on the rest of the patrons. No one at the venue was armed.

About 150 to 200 people — including 16 students from private Christian school Pepperdine University, along with others from California Lutheran University and California State University Channel Islands — were inside Borderline when witnesses said Long tossed a smoke device into the crowd and then, amid the confusion, fired at least 30 shots.

Deputies and highway patrolmen arrived at the bar within minutes of receiving multiple 911 calls and began assessing the grim, gruesome situation, Sheriff Geoff Dean said during an earlier Thursday news conference.

“It is a horrific scene in there. There is blood everywhere,” Dean said. He later described it as "hell."

Sheriff's Sgt. Ron Helus, a veteran of 29 years, arrived first on the scene and immediately entered the bar with a patrolman after hearing gunfire. But as the two made their way inside, Helus was shot several times. The patrolman pulled the sergeant from the line of fire, and Helus was taken to a local hospital, where he was pronounced dead early Thursday.

"Ron was a hardworking, dedicated sheriff sergeant," Dean said while holding back tears. "He was totally committed. He gave his all. And tonight, as I told his wife, he died a hero because he went in to save lives. To save other people."

Witnesses inside the bar -- which bills itself as "Ventura County's largest country dance hall and live music venue" -- told reporters how some patrons used chairs to break windows in a bid to escape the chaos while others scrambled between shots to hide in the establishment's attic. Dean said people also hid in the attic, bathroom and under tables to escape the hail of bullets.

There were six off-duty officers at the bar that night.

"It's just amazing. There were probably six off-duty officers in there from a couple different agencies and I've already talked to a parent who said they stood in front of my daughter," Dean said.

One other person suffered a "minor gunshot" wound, while 15 to 20 people were injured by jumping through windows and diving under tables, according to the sheriff. Pepperdine University officials said two of its students were treated for injuries and released. One student who was at the bar remains unaccounted for.

“We all just kind of froze for a split second and then everyone booked it and dove to the floor," said Teylor Whittler, who was on the dance floor when the shooting started. "After the first round it was quiet for about five seconds, and then some guys who were next to me on the floor got up and started sprinting toward the back door and yelled at everyone, ‘Get up! Run! He’s coming!”

Whittler, a daughter of a military veteran, told "Fox & Friends" she was at the bar celebrating a friend's 21st birthday when shots rang out. She said of the 11 people she was with, there are still five friends who she hasn't heard from yet. She recalled getting trampled on and hit in the head with a barstool when patrons made a dash to the door. A man eventually pulled her up and helped her escape.

She described the gunman as wearing all black clothes, a black baseball cap and a ski mask-type item partially covering his face. Several other witnesses offered a similar description, telling reporters the tall gunman first shot at a bouncer working the bar's door and then opened fire -- seemingly at random -- at those inside.

Whittler said the gunman “knew what he was doing.”

“While I was inside I would say [I heard]…about a good 30 seconds [of gunshots]…he had two [magazines] that I know with him. He changed them within about six seconds, which was really fast,” she said.

“As soon as he walked in he had perfect form…he looked like he knew what he was doing. He had practiced, he had been shooting [before]," she told "Fox & Friends."

WITNESSES DESCRIBE CHAOTIC SCENE DURING THOUSAND OAKS SHOOTING

Aside from the college students filling the bar, survivors of the 2017 Las Vegas massacre -- which occurred during a country music festival -- were also in Borderline.

LAS VEGAS SHOOTING SURVIVORS WERE INSIDE THOUSAND OAK BAR, FRIENDS SAY

Chandler Gunn, 23, of Newberry Park, said a friend who works at the bar was also at Route 91 Harvest Festival in Las Vegas on Oct. 1, 2017, when a gunman fired a barrage of bullets from a hotel room perch, The Los Angeles Times reported.

"A lot of people in the Route 91 situation go here," Gunn said. "There's people that live a whole lifetime without seeing this, and then there’s people that have seen it twice."

Josh Coaly, 27, had been to Borderline several times with his friends -- including one who also survived the Vegas shooting, The Times reported. Coaly said the unidentified friend was in good condition.

Carl Edgar, 24, of Tarzana, told The Times he had about 20 friends inside the bar, which he also frequents.

“As far as I know, all of my friends are OK, safe,” he said. “There are a few people we can’t get a hold of, but in these situations, people usually turn off their phones to be safe so I’m not gonna get too worried. A lot of my friends survived Route 91. If they survived that, they’ll survive this.”

President Trump said he was briefed on the "terrible shooting" and offered his condolences to the 12 people who died.

“I have been fully briefed on the terrible shooting in California. Law Enforcement and First Responders, together with the FBI, are on scene. 13 people, at this time, have been reported dead. Likewise, the shooter is dead, along with the first police officer to enter the bar,” the president tweeted. “Great bravery shown by police. California Highway Patrol was on scene within 3 minutes, with first officer to enter shot numerous times. That Sheriff’s Sergeant died in the hospital. God bless all of the victims and families of the victims. Thank you to Law Enforcement.”

Vice President Mike Pence also tweeted: "@POTUS & I have been briefed on the attack in Thousand Oaks, CA. Our hearts are with the victims, survivors, & their families. A heroic sheriff’s sergeant was killed. We commend the action of all first responders…Please pray for comfort & healing for their families & all impacted. @POTUS directed the full resources of the federal government to support the investigation."

California Gov. Jerry Brown called the shooting a "heinous act."

Police said additional units from the California Highway Patrol, Simi Valley and the F.B.I. were on the scene at Thousand Oaks, which is about 40 miles up the coast from Los Angeles.

Borderline Bar and Grill opened in the late 1980s and boasts "2,500 square feet of wide-open dance floor," according to its website.

The site adds: "Borderline has provided a haven for country line dancing folks of all ages."

Fox News' Amy Lieu and The Associated Press contributed to this report.