The suspect in the murder of a San Antonio police detective was arrested Monday afternoon.

San Antonio Police Chief William McManus said that 31-year-old Otis Tyrone McKane was taken into custody without incident at around 4:30 p.m. local time. McKane was charged with capital murder.

McManus said authorities had pulled over a car McKane was a passenger in on Interstate 10, on the eastern edge of San Antonio. The car was being driven by a woman and a 2-year-old child was also in the vehicle. It was not immediately clear what connection McKane had to the woman and child.

The arrest ended a 30-hour-long manhunt following the shooting of Det. Benjamin Marconi, 50, who was writing a traffic ticket when he was killed in his squad car late Sunday morning outside police headquarters.

Investigators believed McKane pulled up behind Marconi's squad car, walked up to the officer's driver's-side window and opened fire. Authorities say the driver said the driver Marconi pulled over was not connected to the shooter.

"Everyone is relieved," McManus told reporters at a Monday evening news conference. "I don't think anyone slept last night."

McManus said that McKane had a criminal record, but did not elaborate. The chief also said that a vehicle sought by police was found near McKane's home.

Surveillance video shows McKane at San Antonio police headquarters about four hours before Marconi 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.

While being escorted to Bexar County Jail later in the night, McKane told reporters that he was angry with the court system for not letting him see his son and he “lashed out at somebody who didn’t deserve it.”

In his words, "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." He said he wished to apologize to the family of the slain officer.

The shooting was one of several weekend attacks that authorities say targeted law enforcement in multiple states.

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. The sergeant was released from the hospital Monday.

Police officers also were shot and injured during traffic stops in Sanibel, Fla., and Gladstone, Mo., on Sunday night, but authorities have not suggested these were targeted attacks.

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.

The Associated Press contributed to this report.

Click for more from FoxSanAntonio.com.