Brooklyn prosecutors on Wednesday defended their decision not to seek bail for an illegal immigrant charged with raping a 13-year-old girl when he was 19 — describing it as “a sexual relationship.”

“The case was reported by the girl’s mother, alleging that her daughter had a sexual relationship with an older teenager, which constituted statutory rape,” a spokesman for Brooklyn District Attorney Eric Gonzalez’s office said.

“Accordingly, we did not request bail for this nonviolent felony that allegedly took place a year-and-a-half ago.”

Guatemalan national Miguel Federico Ajqui-Ajtzalam, now 20, was arrested Thursday and hit with charges including second-degree rape for allegedly having sex with the girl on five occasions between October and December 2018.

At Ajqui-Ajtzalam’s arraignment Friday, Assistant District Attorney Jordan Rossman said that she was just 13 at the time and he was 19 — but described the alleged victim as “the defendant’s ex-girlfriend.”

“This case has been reviewed by senior prosecutors in our Special Victims Bureau, and they are recommending supervised release,” Rossman told Brooklyn Criminal Court Judge Hilary Gingold, ­according to a transcript of the proceedings.

Gingold ultimately agreed to ­allow Ajqui-Ajtzalam out on ­supervised release.

But she noted that while it was technically alleged statutory rape, “I don’t think a 13-year-old can consent, legally or otherwise, to sex.”

She also seemed troubled to learn that the city’s Administration for Children’s Services had not been notified of the case.

“I believe that ACS should be contacted,” Gingold said. “If this child is not in a safe home that allowed this to happen, that should be an investigation as well.”

The prosecutors’ descriptions of the alleged crime appalled advocates for victims.

“A 13-year-old is a child,” said Jane Manning, director of the Women’s Equality Justice Project and a former Queens sex-crimes prosecutor.

“It’s beyond disturbing to hear a prosecutor referring to her as an ‘ex-girlfriend’ instead of a ‘child victim of rape,’ which is what she is.”

“Ongoing sexual abuse of a ­13-year-old is not a ‘relationship’ as the prosecutor called it,” she said. “It’s a crime.”

Ajqui-Ajtzalam was taken into custody by US Immigration and Customs Enforcement on Monday.

But the agency said it was “frightening” that “he was released onto New York City streets to possibly re-offend” in the first place.