This photo provided by the San Antonio Police Department shows Otis Tyrone McKane. A manhunt for a suspect in the fatal shooting of a veteran Texas police detective ended Monday, Nov. 21, 2016, with an arrest in the killing, authorities said. San Antonio Detective Benjamin Marconi, who was killed Sunday while writing a ticket, was a 20-year veteran of the force. San Antonio Police Chief William McManus said Monday evening that a 31-year-old man, Otis Tyrone McKane, was arrested on a capital murder warrant without incident after the car he was driving was stopped Monday afternoon on an interstate. (San Antonio Police Department via AP)

The suspect arrested in the ambush shooting of a San Antonio police detective has said he was angry about a child-custody battle and “lashed out at somebody who didn’t deserve it.”

Otis Tyrone McKane was being led by police to the Bexar County Jail late Monday when he told reporters that he was angry with the court system for not letting him see his son and took it out on Detective Benjamin Marconi.

“I’ve been through several custody battles, and I was upset at the situation I was in, and I lashed out at someone who didn’t deserve it,” McKane said. He said he wanted to apologize to the family of the slain officer.

McKane, 31, of San Antonio, was arrested on a capital murder charge Monday afternoon in the fatal shooting of Marconi. The detective was shot as he sat in his squad car Sunday after making a traffic stop. Authorities have said a gunman walked up to Marconi’s driver’s-side window and fired.

It was one of several weekend attacks against law enforcement in multiple states.

The San Antonio detective and officers shot in Missouri and Florida were conducting routine tasks Sunday when they became the targets of violence. Marconi was writing a traffic ticket.

“I think the uniform was the target and the first person that happened along was the first person that (the suspect) targeted,” San Antonio Police Chief William McManus said.

In Missouri, a St. Louis police sergeant was shot twice in the face Sunday evening while he sat in traffic in a marked police vehicle. He was released from a hospital Monday.

Law enforcement officials say there’s been an alarming spike in ambush-style attacks. Sixty officers, including the San Antonio detective, were shot to death on the job this year, compared with 41 in all of 2015, according to the National Law Enforcement Officers Memorial Fund. Of the 60 killed, 20 were purposely targeted by their assailant compared with eight last year, the group said.

Police officers also were shot and injured during traffic stops in Sanibel, Florida, and Gladstone, Missouri, on Sunday night, but authorities have not suggested those were targeted attacks. All the shootings come less than five months after a black military veteran killed five white officers at a protest in Dallas — the deadliest day for American law enforcement since Sept. 11, 2001.

Race was a factor in the Dallas attack, but police have not said if race played a part in any of the attacks on Sunday. In San Antonio, the suspect is black and the officer was white. In St. Louis, the suspect was black, but police have not released the officer’s race. Most killings of police officers are carried out by white men, and most people shot and killed by police are white, said Craig W. Floyd, president of the National Law Enforcement Officers Memorial Fund.

Chief McManus said McKane was arrested on a capital murder warrant without incident after the car he was riding in was stopped Monday afternoon on an interstate.

McManus said earlier that he doesn’t believe the suspect has any relationship to the motorist who was pulled over initially.

Surveillance video shows the suspect at San Antonio police headquarters about four hours before the 50-year-old Marconi, a 20-year veteran of the force, was shot. The suspect asked a desk clerk a question but left before receiving an answer, said McManus, who declined to say what the man asked.

“I don’t know why he was in headquarters. We have some ideas,” he said.

St. Louis Police Chief Sam Dotson declined to name the 46-year-old officer who was shot and wounded there. He said the officer is a married father of three and has been with the department for about 20 years.

“This officer was driving down the road and was ambushed by an individual who pointed a gun at him from inside of his car and shot out the police officer’s window,” Dotson said.

The suspect, 19-year-old George P. Bush III, was wanted for questioning in recent violent crimes that included several robberies, a carjacking and perhaps a killing, Dotson said without elaborating.

“We believe he knew he was good for those crimes and that we were looking for him,” Dotson said. “That’s why he aggressively attacked a police officer.”

Police said Bush was later killed in a shootout with officers.

On July 7, Micah Johnson shot and killed five law enforcement officers who had been working to keep the peace at a protest in downtown Dallas over the fatal police shootings of black men in Minnesota and Louisiana. Ten days after that attack, a man wearing a ski mask and armed with two rifles and a pistol killed three officers near a gas station and convenience store in Baton Rouge, Louisiana. And earlier this month, two Des Moines, Iowa-area police officers were fatally shot in separate ambush-style attacks while sitting in their patrol cars.

“It’s always difficult, especially in this day and age, where police are being targeted across the country,” McManus said.