John Russell Houser’s final days were restless and erratic. He roamed widely here. He snapped at some people, broke down in tears in front of others, begging for their prayers. But on many days, he seemed perfectly composed, well-spoken even.

He was desperate for money, though, attempting to sell his car to a stranger, offering to do odd jobs and trying to talk others into starting a business. And in at least one conversation, he offered a glimpse of the violence of which he was capable.

His few short weeks in Lafayette ended in a mass shooting Thursday that left two people dead and nine injured inside a movie theater. Houser also took his own life.

There are lingering questions about the gaps in the database used to perform background checks on gun buyers that allowed Houser, who had a history of mental illness and making violent threats, to legally purchase 17 months ago at an Alabama pawnshop the semiautomatic handgun used in the shooting.

Now the nation is once again reeling in the wake of a mass shooting, and many people here are combing through their encounters with Houser for signs of the brokenness within or the carnage to come.

Here's what we know about John Russell Houser, the man accused of fatally shooting two people and injuring nine inside a movie theater in Lafayette, La. (The Washington Post)

Many of those who met Houser here in recent weeks have asked themselves whether they could have done anything differently. Volunteers at a church food pantry in Lake Charles instantly recognized Houser, 59, when TV stations flashed his picture. The recollection was immediately accompanied by hurt and regret.

Houser, a political provocateur turned troubled drifter, had wandered in a week before the shooting on July 16 and broken down in tears, church members said.

“He stayed for a long time, just crying a lot. All our workers and volunteers tried to talk to him,” said Pastor Tony Bourque. “He just kept saying he was severely depressed.”

Houser stayed for at least an hour, sobbing throughout. He wouldn’t say much about his difficulties. He asked the volunteers at the pantry to pray for him, and they did.

Since the shooting, one church member in particular who prayed with Houser has been beating herself up, Bourque said. “She keeps wondering if she could have done something to help, and I told her, ‘You can never know the layers of stories that make up someone’s life.’ ”

After the shooting, authorities have been working to stitch together a timeline of Houser’s recent activities in an attempt to understand what led him to open fire on a crowd of strangers.

His family in Columbus, Ga., described Houser as mentally ill and said his life had been unraveling for years. In 2006, when Houser applied for a permit to carry a concealed weapon in Russell County, Ala., he was turned down because of a prior arrest for arson and a domestic-violence complaint. Houser was also subject to an order to be committed to a hospital after officials in Georgia determined he was a danger to himself and others following a series of events during which he stalked his daughter and other family members.

Yet, in February 2014, he was able to legally purchase a .40-caliber semiautomatic handgun at a Phenix City, Ala., pawnshop, meaning he was able to pass a federal background check that should have disqualified him.

Gun-control advocates say the episode reveals a major flaw with the federal database used to perform background checks on prospective gun owners: often states drag their feet when it comes to entering information into it.

“The database is only as good as the information that is put into it,” said Ari Freilich, a staff attorney with the Law Center to Prevent Gun Violence.

He noted that Georgia has reported only about 7,000 mental health records into the federal database, while Virginia — a state with a smaller population — has reported more than 211,000.

Family members say Houser has been estranged from them for years. Rem Houser, 61, a financial adviser, said he last spoke to his younger brother, whom he described as depressed and withdrawn, on the Fourth of July. “Just real shallow,” he said of the conversation. “I didn’t know where he was. I didn’t ask. He didn’t tell me.”

Houser came to Lafayette on July 2 or 3, police said, and took up residence at a Motel 6 in the north part of town, just a 10-minute drive from the movie theater.

There were signs, police said, that in the last few weeks of his life, Houser was trying to get a grip on an existence that had been spinning out of control. His mother had just lent him $5,000.

But the money did not last long. Just days before the shooting, Houser visited the Cracker Barrel restaurant behind his motel. He had come in to eat just three days earlier, but this time he handed the cashier a note. Houser had scrawled that he needed money and offered to do yard work for the restaurant. He also offered to sell his car for $600 and left his phone number.

The owner of K&D Seafood Express, a convenience store and restaurant down the street from the Motel 6, immediately recognized Houser’s picture. Houser had visited the store on consecutive days this month.

“He looked normal but like the kind of people that have a drinking problem,” Johnny Ha said.

Houser asked for money.

“He was talking about he’s from another state, he ran out of gas,” Ha said.

Ha said he offered Houser food but told him he couldn’t give him cash. Houser didn’t accept the offer.

Houser returned to the store the next day, Ha said. “He told me the same story, that he needs gas money. I said, ‘Sorry sir, no. I cannot help you.’ ”

Police said Houser also talked to others in Lafayette about making money by opening a quick oil change service.

“He was circulating while he was here,” said Lafayette Police Chief Jim Craft. “He was out and about. . . . Maybe he was testing, looking for a soft spot.”

At the Motel 6, Bob Fisher, 59, said he frequently spotted Houser in the motel’s tiny fenced-in pool.

“He was polite, well-spoken. I’d say, ‘How’s the water?’ Just small talk,” said Fisher, who recalled that Houser occasionally bought alcohol at the RaceTrac gas station across from the motel.

Others had much stranger encounters with him.

At a bar bistro downtown, Houser, who was nursing a Pabst Blue Ribbon beer, pulled up a chair next to two women, and launched into a meandering conversation about killing pets.

“He talked about how people spend too much money on their pets when they get sick,” said Bonnie Barbier, who had her two dogs with her at the time. A conversation about her dogs soon led to Houser explaining how he had chased his former cat outside and tried to kill it by clubbing it with rebar.

Next came Houser’s proposals for a more convenient way to euthanize pets — by drugging them and then finishing them off with an ax.

“It was an insane, one-sided conversation,” said Barbier, 31. “I was scared he was going to hurt my dogs. I just nodded and smiled and tried to get away from him as soon as I could.

“It just overwhelmed me,” she added, “the fear of being that close to a murderer.”

But of all in Lafayette who came face to face with Houser, among the last was Lucas Knepper, who sat in Houser’s row at the theater, just six seats away.

Knepper, 21, saw the flash from the muzzle of Houser’s gun. Even as he rushed toward the theater exit, he said he kept his eyes fixed on Houser.

“I remember he had a blank stare, not angry at all,” he said.

Houser had an almost relaxed posture, Knepper said, as he kept shooting and shooting and shooting.

Fletcher reported from Washington. Amy Brittain and Joe Kovac Jr. in Columbus, Ga., and Ashley Cusick in Lafayette contributed to this report.