A man is accused of killing his grandmother and then leaving her body in a pile of garbage on a Brooklyn sidewalk early Thursday morning, a law enforcement source said.

A sanitation worker made the gruesome discovery on Union Street near Troy Avenue, around 1:46 a.m., an NYPD spokeswoman said. 

Joyce Spears, 70, of Brooklyn, was found wrapped in a bedsheet with trauma to her body, police said. She was pronounced dead at the scene.

Officers also found a 35-pound dumbbell with blood on it sitting below the window of a third-floor apartment where Spears lived with her grandson, Barry James, 32, the source said. Investigators believe she was hit with it from above.

But when officers attempted to speak with James, he barricaded himself inside the apartment, police said. Members of the Emergency Services Unit were forced to cut a hole in the door in order to remove him, they said. He was taken into custody around 6:30 a.m.

James, who has 12 prior arrests, was charged with second-degree murder Thursday evening, police said.