The former Marine who fatally shot 12 people inside a California bar posted a message on social media during the attack saying he was bored but sane, law enforcement officials told NBC News.

Ian David Long, 28, also wrote that he knew his mental state would be debated for years, law enforcement officials said.

Long made two separate posts amid his shooting rampage at the Borderline Bar and Grill in Thousand Oaks Wednesday night, the officials said.

The law enforcement sources did not specify which social media platforms he used.

A spokesperson for Facebook, which owns Instagram, declined to comment on whether anything had been posted to Facebook or Instagram. Facebook also said no story was posted on Instagram but wouldn't elaborate further, deferring to law enforcement.

Twitter did not return a request for comment.

On Thursday, Facebook spokeswoman Sarah Pollack said: "Our hearts are with the victims and families affected by this horrendous act. We've removed the shooter's accounts from Facebook and Instagram and will remove any praise or support for the crime or the shooter as soon as we're aware."

Long’s use of social media was first reported by TMZ.

Investigators are still piecing together a precise timeline on the shooting that killed 12 bar employees and patrons. But it's believed that Long, who was dressed in black and armed with a high-powered Glock handgun with an extended magazine, entered the Borderline Bar & Grill about 11:15 p.m.

It's not exactly clear when he posted the social media messages, but law enforcement officials said that he walked to the back of the bar after hearing the sounds of police sirens and began indiscriminately firing on patrons.

The officials said he took a position of cover before fatally shooting Sgt. Ron Helus of the Ventura County Sheriff's Office.

Investigators believe Long then shot additional victims inside the bathroom stalls, as well as at least one person who was trying to escape through the bathroom window, the law enforcement officials said.

Ian Long, 28, who is a veteran of the Marines, has been identified as the shooter at Borderline Bar and Grill in Thousand Oaks, California. via Facebook

A short time later, Long was found dead of a suspected self-inflicted gunshot wound.

Authorities said Long, a former Marine gunner who served one tour in Afghanistan, had been experiencing emotional issues.

Investigators are still trying to figure out the motive for the attack.

When authorities entered his home in nearby Newbury Park, they found evidence that he punched multiple holes in the walls, law enforcement officials said.

Local cops were called to his home for a domestic disturbance earlier this year, authorities said. Long was found to be "somewhat irate" and "acting a little irrationally" but he wasn't taken into custody.