Devin Patrick Kelley has been identified as the gunman who killed at least 26 people at a church Sunday morning in Texas, a U.S. official told The Daily Beast. A week before he committed the worst massacre at a place of worship in American history, Kelley posted a photo of a semiautomatic rifle to Facebook with the caption: “She’s a bad bitch.”

It’s part of a disturbing picture emerging of the 26-year-old, who was discharged under dishonorable circumstances from the Air Force in 2014, according to Defense Department records. Kelley was court-martialed in November 2012 for assaulting his wife and their child. A judge sentenced him with a bad-conduct discharge, 12 months confinement, and two reductions in rank to basic airman, according to an appeals court decision in 2013 that affirmed the decision against Kelley.

Kelley entered First Baptist Church at approximately 11:30 a.m. Sunday and opened fire, witnesses reported. Officials said he wore a ballistic vest and was dressed in all black. A law-enforcement source close to the investigation said the rifle Kelley used is similar to the one pictured but could not confirm it is the same rifle.

When Kelley exited the church, he dropped his rifle, a law-enforcement source told The Daily Beast. Kelley was pursued by a civilian with a shotgun and died near the city of New Berlin, Sheriff Joe Tackett said Sunday evening at a press conference. It is unclear if Kelley was killed or died from a self-inflicted gunshot wound.

Police told reporters that Kelley’s victims range in age from 5 to 72, with approximately 20 wounded being treated at area hospitals.

Kelley was a resident of New Braunfels, a suburb of San Antonio, according to public records. Kelley was married and his mother-in-law listed a P.O. box in Sutherland Springs as a mailing address. A LinkedIn account appearing to belong to Kelley said he enlisted in the U.S. Air Force in 2009 after graduating from high school.