A man accused of killing three homeless people near Long Beach-area homeless encampments was charged Tuesday with murder, prosecutors said.

Tracy Walker, 56, also was charged with using a knife in the killings and being a felon in possession of a gun, according to a statement from the Los Angeles County district attorney’s office.

Walker was arrested last Thursday at a homeless encampment next to the Compton Creek riverbed in Rancho Dominguez, an unincorporated area near Del Amo Boulevard and the 710 Freeway. Authorities didn’t immediately say whether Walker was living at the encampment.

When homicide detectives interviewed him, Walker implicated himself in all three killings, according to a statement from the Sheriff’s Department.

He was being held on $2 million bail, prosecutors said. It wasn’t immediately clear whether he had an attorney to speak for him.

Walker is charged with stabbing to death 26-year-old Patricia Loeza last June; beating and stabbing Kenneth Edward Jones, 26, in January and stabbing 30-year-old Cesar Mazariegos last week.

The killings all took place near the Compton Creek riverbed and authorities said the victims may have been staying at homeless encampments there.

Authorities didn’t disclose a motive for the attacks.

“The heartless and brazen nature of these murders against some of the most helpless members of our community shock the conscience,” District Attorney George Gascón said in a statement.

Gascón, who opposes the death penalty, said his office would seek a life sentence for Walker.