A Manhattan judge sent a Bronx man to jail Wednesday after prosecutors provided new details about how he allegedly stabbed his ex-girlfriend to death in her West Harlem apartment building this week.

Assistant District Attorney Jonathon Junig in court said 41-year-old Luis Marquez stabbed 47-year-old Carmen Lopez more than 20 times, puncturing her liver and aorta in a brutal attack caught on her building’s surveillance system. Junig said Marquez had stalked Lopez while she was out at a club with her friends, then waited for two hours in the stairwell until she returned home just after 4 a.m. Monday.

When Lopez came out of the elevator onto her floor, Marquez allegedly lunged at her, pinned her to the ground and stabbed her with a large knife as she screamed for him to stop. Police who came to the scene on West 129th Street near St. Nicholas Terrace found her critically injured. First responders took her to Mount Sinai Morningside Hospital, where she was pronounced dead.

Prosecutors said Lopez and Marquez had dated on and off for several years and he was often jealous and controlling. The couple had no documented history of domestic violence, according to the district attorney’s office.

Marquez was arrested Tuesday and charged with murder in the second degree. His attorney, Kristin Bruan of the nonprofit Legal Aid Society, declined to comment on the case.

The stabbing left neighbors horrified Monday as they woke up to the sight of blood spattered across their building’s hallways. Residents said Lopez lived with several of her children. Marquez lives in Highbridge, according to the NYPD.

Neighbor Ronald Spry told Gothamist he saw blood “all up and down the staircase” from the building’s third floor to the lobby. He said he didn’t know Lopez personally but was shaken by her death.

“If I was up, I probably would have helped her,” he said. “We got to look out for each other.”

Domestic violence complaints have spiked roughly 18% across New York City over the past five years, according to NYPD data, but experts have struggled to pinpoint the cause. The department rolled out a new dedicated domestic violence unit last month, adding about 450 investigators to every precinct in the city who will focus specifically on the issue.

This is a developing story based on preliminary information from police and has been updated with additional details.