One frigid morning in January 2019, a New York University student woke up in her apartment near the school’s Manhattan campus to find a masked man standing over her in bed. He told her not to scream, she told investigators, and then he held her down and raped her.

Two months later, the police matched fingerprints found on an unopened condom wrapper in her room to those of a 22-year-old man named Tyler Lockett, who happened to be in jail on charges of having committed three burglaries in Brooklyn.

What should have been a lucky break for law enforcement, however, soon turned disastrous. Instead of being charged with rape, Mr. Lockett was released from jail in July and the authorities said he attacked three more women over two weeks before he was caught.

Investigators in the New York Police Department’s Special Victims Division made a series of errors leading up to Mr. Lockett’s release, including failing to inform prosecutors he was a rape suspect after his fingerprints were found, according to several law enforcement officials, the student’s mother and a police document.