A Marine veteran clad in black and armed with a .45-caliber Glock handgun shot his way into a Southern California bar crowded with college students and unleashed hell before turning the gun on himself, officials said Thursday.

When it was over, 12 others, including a police officer who tried to stop the carnage, were also dead and many more were wounded.

While investigators identified the gunman as 28-year-old Ian David Long and tried to establish a motive, the nation was once again forced to grapple with tragedy and embark on the all-too-familiar rituals of mourning after yet another mass shooting.

When the shooting started late Wednesday at the Borderline Bar & Grill in normally peaceful Thousand Oaks, about 40 miles west of Los Angeles, several hundred people were inside for a "college country night," Ventura County Sheriff Geoff Dean said.

"It's a horrific scene in there," Dean said. "There's blood everywhere."

The sheriff said the gunman first shot a security guard standing outside, then "stepped inside, turned to the right, shot several other security and employees and began opening fire inside the nightclub."

He added, "We have no idea what the motive is at this point."

As police prepared to search the suspect's home, Dean said Long had a history of minor run-ins with police. As recently as April, he said, deputies were called to his house after reports of a disturbance, and they found Long to be "somewhat irate," and "acting a little irrationally."

There was some discussion about whether Long might be suffering from post-traumatic stress disorder, Dean added. But ultimately Long was assessed by a mental health specialist who cleared him and didn't feel he was eligible to be taken in for involuntary psychiatric evaluation.

Dean said Long was also the victim of an assault at a bar in 2015, the sheriff said.

The weapon Long used in Wednesday night's shooting was a legally purchased Glock 21 with an extended magazine, Dean said. Long, who officials had earlier described as a heavily tattooed white man, did not appear to be carrying a driver's license or any other form of IDs, Dean said earlier on "Today."

OFFICER 'DIED A HERO'

The slain police officer was identified as Sgt. Ron Helus, a 29-year police veteran with a wife and son who was looking to retire in the next year.

"He was hard-working, he was totally committed, he gave his all and, tonight, as I told his wife, he died a hero," an emotional Dean said. "He gave his life to save other people."

Helus, 54, spoke to his wife by phone just before he went inside the bar, telling her, "I gotta go, I love you, call you later," according to Dean.

President Donald Trump sent two tweets paying tributes to the authorities and victims. He praised the "great bravery shown by police" and said, "God bless all of the victims and families of the victims."

As Helus' body was carried by hearse from Los Robles Regional Medical Center in Thousand Oaks to a coroner's facility in the city of Ventura, residents lined the highway and many saluted the passing motorcade.

Meanwhile, the grieving father of 22-year-old victim, Cody Coffman, was mourning his slain son.

"I talked to him last night before he headed out the door," a weeping Jason Coffman told reporters. "First thing I said was please don't drink and drive. Last thing I said was, 'Son, I love you.' That was the last thing I said."

Then, breaking down, Jason Coffman said, "Oh my God."

The first reports of shots being fired occurred around 11:20 p.m. (2:20 a.m. ET) Thursday, police said.

Three minutes later, Helus arrived at the bar with a California Highway Patrol officer, Dean said. Hearing more gunfire, Helus raced inside and "was struck multiple times with gunfire," Dean said.

The patrolman was able to drag Helus out of the line of fire, but he died in the hospital hours later, the sheriff said.

A SWAT team, FBI and others officers arrived soon after. When they entered the bar they found it littered with bodies, shooting survivors huddling in terrors and others desperately trying to get out.

"They found people hiding in restrooms, people hiding in attics," Dean said. Other witnesses described people using bar stools to break windows and escape.

Several witnesses reported seeing what they described as smoke bombs going off inside, although police could not confirm that.

Six off-duty, unarmed police officers from various agencies were at the bar when the shooting began, according to Dean.

"I’ve already spoken to a parent who said, 'They stood in front of my daughter,'" he said. "It was amazing."

Ten to 12 people suffered injuries of varying severity, with others with more minor wounds escaping and taking themselves to the hospital, Dean added.

The Los Robles Regional Medical Center confirmed later that 10 of the 11 victims they saw were treated for gunshot wounds and lacerations and released. None were admitted and the only patient who did not go home was Helus.

Pepperdine University, in nearby Malibu, said that some of its students were believed to have been at the bar and that it was working "to identify and provide support to those students."

Thousand Oaks was ranked the third-safest city in the United States this year, according to the data analysis website Niche.

"I've been a cop for 41 years," Dean said. "But I've learned it doesn't matter what community you're in, it doesn’t matter how safe your community is. It can happen anywhere."

Survivors like John Hedge described in cinematic detail what it was like when the shooting erupted.

"I was actually about to leave when you start hearing pop, pop, pop. It sounded like fireworks or something," he told NBC News. "My stepdad dove and took cover and yelled at me, 'John, hit the deck! Hide!' So I get down. And the gunman started opening fire on the cashiers, the people working the cash register on the front desk."

Kayla Simmons said she was inside the bar when shots were fired directly behind her. She said she could still hear the shots when she escaped outside into the parking lot.

"I saw the shots go off, although I didn’t really see the guy," she said. "I knew something was wrong straight away. I just wanted to get down as soon as I heard the first shot go off."

Hours later, the nearby Goebel Senior Center was transformed into a gathering place for friends and family members of those who were at the bar and whose fates were not known. Clustered in groups, they hugged and some prayed while they waited anxiously for news.

Among them was Ken Dunham, whose 21-year-old son Jake had been in the bar and remained unaccounted for.

"I keep calling it but there’s no answer," he told NBC Los Angeles. "It just keeps ringing out. And he always answers his phone."

Dunham said he was alerted to the shooting by his son’s friends who raced to the house and banged on his door.

One college student who said he was a regular at the Borderline told the channel he had at least 10 friends inside.

"No one's gotten back to me," he said on camera without giving his name. "I'd like to hope for the best, but I have no idea."

Shooting survivor Holden Harrah told MSNBC she feels "very lucky to be here. Very, very lucky to be on my two feet." She said she always thought of the bar as a "safe haven" and can't believe a friend of hers is among the wounded.

"I'm just trying to process everything," Harrah said."Nothing like this ever happens, and it just blows me away that it did happen."

The bar opened in 1993 and describes itself as a "haven for country line dancing folks of all ages." It says it's hosted many famous acts including the Beach Boys.

It is the 307th mass shooting in the United States this year, according to the Gun Violence Archive.