The man who shot dead 26 people at a smalltown Texas church carried out the attack after a "domestic situation" with his family and his in-laws, officials have revealed.
Public safety officials said Devin Kelley had sent "threatening text messages" to his mother-in-law in the lead-up to the incident, which saw an 18-month-old toddler killed.
Officers said he phoned his father following the massacre to tell him he had been shot.
Following the attack, he exchanged gunfire with two men who chased his car off the road, said Sheriff Joe Tackitt.
He died soon afterwards of a self-inflicted gunshot wound.
"There was some gunfire exchanged, I believe, on the roadway also, and then (the shooter's vehicle) wrecked out," Sheriff Tackitt said.
Officers said they believed the motive for the attack was the domestic situation within his family and in-laws, and that it was not religious or racial.
Kelley shot worshippers during Sunday service at the First Baptist Church in Sutherland Springs, 30 miles southeast of San Antonio.
Sheriff Tackitt told CNN that Kelley's in-laws went to the church "from time to time" but were not there during the attack.
The 26-year-old wore black tactical gear and a ballistic vest as he opened fire with an automatic assault rifle in the small town of around 400 people.
Donald Trump has described the shooting as an "act of evil".
"Our hearts are broken but in dark times, and these are dark times, such as these, Americans do what they do best," he said.
The victims range in age from 18 months to 77 and include Annabelle Pomeroy, the 14-year-old daughter of the church's pastor.
Crystal Holcombe was killed alongside three of her children and her in-laws, her cousin Nick Uhlig told the Houston Chronicle and Associated Press.
Twenty others were injured, including a six-year-old boy named Rylan who needed surgery after being shot four times, his uncle told CBS.
Martha Rendon, an official at the University Health System hospital in San Antonio, said five of those injured, including three children, remained in hospital in a serious or critical condition. The patients are aged between four and 57.
Sheriff Tackitt said there was probably "no way" for people to escape once Kelley opened fire.
"It's unbelievable to see children, men and women, laying there. Defenceless people."
As Kelley finished the massacre and tried to escape in his car, a neighbour opened fire and gave chase with another man.
"His vehicle was parked, door open, engine running… him and the neighbour across the street (were) exchanging fire," said Johnnie Langendorff.
"The gentleman with me got out, rested his rifle on my hood and aimed at him, telling him to 'get out, get out'.
"There was no movement, the guy didn't put up a fight or anything."
Kelley was found dead with several weapons in his vehicle.
The shooting comes about a month after gunman Stephen Paddock killed 58 people in Las Vegas – the worst shooting in modern US history.
Mr Trump said the Texas mass murder was not a "guns situation" but a "mental health problem at the highest level".
"We are dealing with the largest mass shooting in our state's history," said Texas Governor Greg Abbott.
He added: "There's so many families who have lost family members. Fathers, mothers, sons and daughters."
The politician also told ABC's Good Morning America he did not think the incident was "just a random act of violence".
Russia's President Vladimir Putin has sent his condolences to Mr Trump over the shooting, according to the Kremlin.
Kelley lived in New Braunfels, Texas, near San Antonio, but officials said he did not appear to be linked to any terror groups.
Domestic terrorism is defined by the FBI as an attack by a person or group that "espouse extremist ideologies of a political, religious, social, racial, or environmental nature".
The US Air Force said he had served in the logistics readiness squadron until being discharged in 2014 for bad conduct after being court-martialled on charges of assaulting his wife and their child.
The manager of a Texas vacation resort has confirmed Kelley worked as a security guard there.
Claudia Varjabedian, manager at the Summit Vacation Resort, said Kelley had been working at the resort for the past month-and-a-half.
She said he "seemed like a nice guy" and was unarmed during his daytime shifts.
Investigators are examining posts Kelley may have made on social media in the days before the shooting, including one that appeared to show an AR-15 semi-automatic weapon.
Kelley's Facebook page has been deleted, but cached photos include one of what appeared to be an assault rifle with the caption: "she's a bad b****".