As investigators asked to keep the suspected cop-killer Markeith Loyd in custody on Wednesday, police said he made one one major mistake on the run that finally led officers to his whereabouts.

NIGHTCLUB GUNMAN TOOK WIFE TO WALMART, BOUGHT BULLETS THE NIGHT BEFORE SHOOTING, SOURCE REVEALS

Loyd, 41, turned up in an abandoned home in the Carver Shores area of Orlando more than a week after police said he shot and killed an officer -- and a month after they suspected him of killing his pregnant ex-girlfriend. He initially tried escaping through the back of the boarded-up house before surrendering in the front yard, Fox 35 reported.

Despite getting hundreds of tips, police said none of them led to Loyd. Instead, they tracked his phone, WTSP reported. Police said they initially believed he had turned it off, but eventually discovered that he had used his phone to send a series of texts.

FLORIDA AIRPORT SHOOTING SUSPECT SAID HE DID IT FOR ISIS, OFFICIALS REVEAL

An affidavit, filed with the Orange County Clerk of Courts, showed that officials wanted to make sure he remained in custody, as is customary for a fugitive facing murder charges. Loyd was recovering in the hospital.

A few shots when Markeith Loyd taken to custody Great work @OrlandoPolice @OrangeCoSheriff & others involved! #fox35 pic.twitter.com/3MBTxptmkM — Jackie Orozco (@ReporterJackie) January 18, 2017

The suspect put up a fight as police arrested him, law enforcement officials said. As officers walked a bloodied Loyd to the police station, he shouted at the cameras: "They beat me up!" Police said his injuries weren't serious.

Loyd tossed two handguns on the ground, one of which could hold 100 bullets, Fox 35 added.

Loyd was accused in the Jan. 9 killing of Lt. Debra Clayton outside a Walmart store and in the death of his ex-girlfriend, Sade Dixon, last month. Investigators said he killed the officer when she tried to take him into custody.

The arrest was the result of the tireless efforts of hundreds of officers, Orlando Police Chief John Mina said. "They've basically been living in their vehicles, using the bathroom in their vehicles, to try and do everything they could to bring justice for the Dixon family and for the Clayton family."

Orange County Sheriff Jerry Demings said at the news conference that the arrest was bittersweet, noting that in addition to Clayton, a deputy in his agency, Norman Lewis, died in a traffic crash during the manhunt for Loyd.

"I believe that our entire community is going to breathe a sigh of relief at this point," Demings said. "They will sleep better knowing tonight that... this maniac is off the streets."

Demings said Loyd would be charged with two counts of first-degree murder in Dixon's death. Loyd will also face one count of attempted first-degree murder and two counts of aggravated assault with a firearm related to the shooting of Dixon's brother and threats against other relatives.

Police arrested a former supervisor at the fried chicken restaurant where Loyd worked, an ex-girlfriend and a niece on charges of helping him in the weeks after Loyd's ex-girlfriend was shot dead.

Mina said he expected more arrests in the case for anyone who helped him evade police. He said investigators didn't know how long Loyd been in the house, which was abandoned but does have ties to associates of his.

"Anyone who harbored, aided or abetted him in any way is going to be arrested, and we know from our investigation that people did assist him," Mina said.

Click for more from Fox 35.