The man charged with setting a fire in Camden that killed two and sent others leaping out of third-story windows early Sunday was homeless and had been trying to sleep in the building’s stairwell, but got angry after residents told him to leave, a law enforcement source said Monday.

Brandon Adams, 34, was charged with two counts of first-degree murder for intentionally setting the blaze, the Camden County Prosecutor’s Office said. Authorities did not provide more information about the two men who were killed.

Firefighters responded to the fire in the 3400 block of Cramer Street about 3 a.m. They found two separate areas of the fire in the three-story apartment building — one in the front hallway and the other in the back hallway, according to the affidavit of probable cause for Adams' arrest.

They discovered one man dead in a third-floor apartment.

Nine people were taken to hospitals in Camden and Philadelphia for treatment of injuries sustained in the blaze, including one man who was taken to Virtua Our Lady of Lourdes Hospital in Camden, where he was pronounced dead, the affidavit says.

About three dozen people were displaced by the fire and a firefighter sustained a shoulder injury, authorities said.

While firefighters were battling the Cramer Street fire, they got a call for a second blaze nearby on the 3800 block of High Street, authorities said. According to the law enforcement source, who was not authorized to publicly discuss the investigation, Adams set that fire as well. No one was injured in that fire, in a single-family home where Adams’ mother had been living before she was evicted, the source said.

It was not immediately known when Adams' mother last lived at the High Street address. Public records show that Adams previously lived at the High Street address or listed it as his home address.

Police located Adams on Sunday several blocks away from the fires, the source said, and he was taken into custody.

Authorities said tips from residents led them to conclude that Adams had set the Cramer Street fire. It was not immediately clear Monday if Adams would face charges in the High Street fire.

The Prosecutor’s Office did not respond to requests for further information.

Displaced residents of the 21-unit apartment building are receiving assistance from the Red Cross and the city’s Department of Human Services, authorities said.

Adams, who is in custody at the Camden County Correctional Facility, faces a pretrial detention hearing Wednesday.