His relationship with his wife had been falling apart for months the day Rigoberto Sanchez arrived home to find his wife had filled two bags with his belongings and told him to leave.

He’d been suspicious his wife was cheating on him, and after moving out he heard through his stepchildren about the new man in his wife’s life, he told Bakersfield police investigators during a recorded interview.

That man — Edwin Lima — worked with Rigoberto Sanchez at the California Correctional Institution in Tehachapi. So did his wife, Sandra Sanchez.

On the night of May 28, 2017, Rigoberto Sanchez went to his wife’s apartment following a heated phone call with Lima, according to court filings. He then stood outside a bedroom window and opened fire at Lima and his wife.

Lima, 33, was struck multiple times and died almost immediately. Sandra Sanchez was not hit.

What was he thinking, detectives asked in the interview, an hour of which was played for jurors Monday in Sanchez’s trial on charges of murder and attempted murder, among other charges.

“I wasn’t thinking at all,” Rigoberto Sanchez said. “That’s the problem.”

Prosecutors say the shooting was a calculated killing, but Rigoberto Sanchez’s defense counsel said Sanchez fired in self-defense after Lima, and then his wife, pointed a gun at him. The trial began Aug. 16.

Rigoberto Sanchez fled to Mexico, where he was arrested weeks later and brought back to San Luis, Ariz., a town right on the border where he was held before being extradited to Bakersfield.

In the interview — held in San Luis — Sanchez, 40, dressed in a gray T-shirt and blue track pants, spends much of the time hunched forward, at times rubbing his face or drinking from a bottle of water. He speaks clearly and at length in response to most questions, but during the first hour, at least, he appeared reticent to talk about why the shooting occurred.

Bakersfield police Detectives Eric Littlefield and Fred Torres use his stepchildren in pressing him for an answer.

Littlefield says they can put together the “how” of what occurred due to witness statements, surveillance cameras that captured Sanchez at the scene and evidence he left including a magazine to a handgun.

But Sanchez’s stepchildren are searching for answers as to why it happened, the detective says. He tells Sanchez his adult stepson was nearly hit by one of the 21 rounds he fired into his wife’s apartment in the 6900 block of Valleyview Drive, in northeast Bakersfield.

Sanchez acknowledges the seriousness of the situation he’s in and his possible fate.

“What kind of dad am I going to be behind bars?” he said. “Know what I mean? I’m never going to get out.”

Rigoberto Sanchez tells the detectives he made changes to his appearance in an attempt to go undetected in Mexico. He stopped shaving his head and grew a goatee, plus got some new tattoos.

But it didn’t matter.

“I stood out like a sore thumb,” he says.

He disposed of the handgun in pieces down a drain in Mexico, he says.

In a second interview held at BPD headquarters, Sanchez rehashes some of what he’s already told investigators, but goes deeper into the minutes before he headed to his wife’s apartment after he and Lima exchanged obscenities over the phone.

At one point, Lima said he’d send Sanchez a video of him and Sanchez’s wife, Sanchez tells the detectives. He says he was driving at the time and had to pull over because “everything started spinning.”

Asked about his intentions when he arrived at the apartment, Sanchez says, “My intentions, I don’t even know what my intentions were.”

Shortly afterward he says, “My intention wasn’t to kill anybody.”

The trial continues Tuesday.