A man was indicted Wednesday on charges that he tried to rape a woman while she was sunbathing in Central Park, prosecutors said.

Jermaine Longmire, 43, of Manhattan Valley, has been charged with one count of first-degree attempted rape and one count of first-degree sexual abuse in connection with the attack in the Great Hills section of Central Park, the Manhattan district attorney’s office said.

“Our parks should be a place where New Yorkers can relax without fearing for their safety, and this alleged conduct will not be tolerated," Manhattan District Attorney Alvin Bragg said in a statement.

Prosecutors said Longmire approached a 21-year-old woman who was sunbathing in the park near West 104th Street and West Drive around 1:30 p.m. on June 24 and exposed himself.

When the woman screamed and tried to run away, Longmire tackled her from behind and tried to rape her, police and prosecutors said.

After the woman fought back, Longmire fled the scene down West Drive, according to police and prosecutors. The woman was taken to a nearby hospital after the attack, the NYPD said.

Detectives who canvassed the area after the attack pulled video from a business that provided a clear image of the suspect’s face, which they submitted to a facial recognition system that produced Longmire as a match, NYPD Chief of Detectives Joseph Kenny said at a news briefing Wednesday.

Kenny said a computer analysis revealed Longmire was wanted on an open bench warrant in New York City for a forcible touching incident that happened in March 2024, when Longmire allegedly approached a woman from behind and grabbed her buttocks.

Longmire, who has eight prior arrests in New York City, as well as a “substantial arrest history” in Florida, Maryland and New Jersey, was also wanted in connection with a “forcible touching pattern” that happened in the transit system in 2023, Kenny said, adding that Longmire allegedly ran up behind “unsuspecting women” and grabbed them. 

Police initially took Longmire into custody on June 26 in connection with the open bench warrant, then arrested him in connection with one of the forcible touching incidents, Kenny said.

In the meantime, investigators working to collect and process evidence in connection with the Central Park attack found Longmire’s DNA on the bikini bottom the 21-year-old woman was wearing when she was assaulted, according to Kenny.

That and other evidence was presented to a grand jury, which indicted Longmire in connection with the attack, Kenny said.

Longmire’s attorney information wasn’t immediately available Wednesday.