THOUSAND OAKS, Calif. (Reuters) - A former U.S. Marine combat veteran opened fire in a Los Angeles area bar packed with line-dancing college students, killing 12 people in a mass shooting that stunned a bucolic Southern California community with a reputation for safety.

The gunman, identified by police as 28-year-old Ian David Long, was found dead of an apparently self-inflicted gunshot wound following the Wednesday night massacre at Borderline Bar and Grill in Thousand Oaks, a suburb 40 miles (64 km) northwest of downtown Los Angeles, law enforcement officials said.

Paul Delacourt, assistant director in charge of the Los Angeles FBI office, said it was too early to speculate on the shooter’s motives but that he appeared to have acted alone.

“We will be sure to paint a picture of the state of mind of the subject and do our best to identify a motivation,” Delacourt said, adding that the FBI would investigate any possible “radicalization” or links to militant groups.

Long opened fire, seemingly at random, inside the barn-style, Western-themed bar at about 11:30 p.m. PST (0730 GMT Thursday), using a .45 caliber Glock handgun equipped with a high-capacity magazine, Ventura County Sheriff Geoff Dean said.

Long was in the Marine Corps from 2008 to 2013, reaching the rank of corporal and serving as a machine gunner in Afghanistan, and the sheriff said he may have suffered from post-traumatic stress disorder.

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

DISTURBANCE CALL

Dean told reporters that in April officers had gone to Long’s home in nearby Newbury Park, about 4 miles (6 km) from the bar to answer a disturbance call and found him agitated. Mental health specialists talked with Long and determined that no further action was necessary, the sheriff said.

“He was raving hell in the house, you know, kicking holes in the walls and stuff and one of the neighbors was concerned and called the police,” Richard Berge, who lived one block away from the home, told Reuters. “They couldn’t get him to come out, so it was like a standoff for four or five hours.”

Berge, who took care of Long’s mother’s dogs, said she told him following that incident she worried her son might take his own life but did not fear he would hurt her.

Dean said he had been told that 150 to 200 people were in the Borderline at the time Long opened fire, adding: “It could have been much, much worse.”

Asked what the scene inside the bar was like, Dean said, “Like ... hell.” Earlier he had described it as “a horrific scene in there. There is blood everywhere and the suspect is part of that.”

The Ventura County Sheriff’s Department said 21 people had been treated for injuries and released at area hospitals.

LATEST MASS SHOOTING

The massacre was the latest shooting rampage in the United States amid a fierce debate over gun control.

After a man fatally shot 11 worshipers at a Pittsburgh synagogue last month, U.S. President Donald Trump said their deaths could have been prevented if an armed guard had been stationed inside the temple.

Slideshow ( 30 images )

Long shot an unarmed security guard outside the bar before going inside, where he fired on security staff, CNN reported.

Ventura County Sheriff’s Office Sergeant Ron Helus, a 29-year veteran, was killed inside. He and a California Highway Patrol officer were the first to arrive at the bar just before 11:30 p.m. PST (0730 GMT) to confront the gunman.

Trump ordered U.S. flags to be flown at half-staff at public buildings and grounds.

The Borderline is popular with students and was hosting a College Country Night at the time of the shooting. Nearby California Lutheran University canceled classes on Thursday while Pepperdine University, about 20 miles away, planned a prayer service.

Slideshow ( 30 images )

Cole Knapp, 19, was inside the bar when the shooting began and told Reuters he saw the gunman walk in and stop at the counter as if to pay a cover charge before he heard gunshots ring out and a young woman at the counter hit with multiple rounds.

“It took a couple of seconds for people to realize what was going on and once that happened it was just utter chaos,” he said.

Knapp said he helped people hide behind a pool table and then fled outside, alerting people on an outdoor smoking patio and helping carry a victim to an ambulance.

SAFE CITY

Thousand Oaks, a leafy, sprawling suburb of 127,000 people, was named the third safest city in the United States for 2018 by the Niche research company.

“I’ve learned it doesn’t matter what community you’re in,” Dean said. “It doesn’t matter how safe your community is. It can happen anywhere.”

In the hours after the shooting concerned family members gathered at a nearby teen center waiting to learn the fate of loved ones.

Jason Coffman wept as he told reporters that his son, Cody, 22, was among the dead.

“Only him and I know how I love, how much I miss him,” he said. “Oh, son, I love you so much.”

Actress Tamera Mowry-Housley confirmed in a statement to ABC News that her niece, Alaina, was killed at the bar.

Among those outside the hospital was Ellen Rivera, who said she had survived the October 2017 slaughter of 58 people at an outdoor concert in Las Vegas - the worst mass shooting in U.S. history.

At nightfall more than 2,000 mourners gathered at a local performing arts center for a candlelight vigil on behalf of the victims, singing “Amazing Grace” and praying. Loud sobs could be heard throughout the 45 minute vigil.