People comfort each other as they stand near the scene Thursday, Nov. 8, 2018, in Thousand Oaks, Calif. where a gunman opened fire Wednesday inside a country dance bar crowded with hundreds of people on "college night."

The FBI is hoping to build a clear profile of a former U.S. Marine combat veteran who killed 12 people in a crowded Los Angeles area bar to discover a motive for the latest shooting massacre in the United States.

The gunman, 28-year-old Ian David Long, entered the Borderline Bar and Grill in Thousand Oaks, a suburb 40 miles (64 km) northwest of downtown Los Angeles, and opened fire at a little before midnight before he apparently took his own life, law enforcement officials said.

The massacre was the latest shooting rampage in the United States amid a fierce debate over gun control, coming less than two weeks after a man shot dead 11 worshippers at a Pittsburgh synagogue.

Paul Delacourt, assistant director in charge of the Los Angeles office of the FBI, 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, with a .45 caliber Glock handgun equipped with a high-capacity magazine, Ventura County Sheriff Geoff Dean said. The bar was packed with college students.

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.