What to Know Bail was set at $500,000 for a man charged with raping an 11-year-old girl in her bedroom

Prosecutors say Julio C. Ayala raped the girl in the top bunk while her brother was in the bottom bunk

His defense attorney says it's a case of mistaken identity

A stranger climbed through a second-floor window, then up to the top bunk of a bed and raped an 11-year-old girl while her brother was in the bottom bunk below, a Brooklyn prosecutor said Sunday.

The prosecutor was arguing to set bail for the suspect, 18-year-old Julio C. Ayala, at $500,000. The judge agreed. Ayala walked in stoically and appeared nonchalant during the hearing.

Ayala was charged with rape, sex-motivated burglary, criminal sexual act, sexual abuse and acting in a manner injurious to a child, the NYPD said.

The rapist left his Bulls hat behind in the girl's room, the prosecutor said. Ayala had previously been seen wearing a hat, but after the rape, he was not wearing one, the prosecutor said.

Ayala had a forged U.S. resident and Social Security card, the prosecution said.

Law enforcement sources told NBC 4 New York that they believe he is an MS-13 gang member.

Ayala lives with his aunt, uncle and two cousins in Brooklyn and works at his uncle's air conditioning business, his defense attorney said, arguing that he has strong community ties and wasn't likely to flee.

The alleged rapist removed an air conditioner to access the window of the girl's bedroom in the Prospect-Lefferts neighborhood, according to prosecutors.

The girl wasn't able to identify him in a lineup but he admitted to the rape, the prosecution said.

According to prosecutors, he said: "I've never done anything like this before."

Ayala's defense attorney said it was a mistaken ID and he had concerns about his client's ability to comprehend.

The next court date was set for Sept. 7.

Ayala was arrested Saturday outside his home at Flatbush Avenue and Linden Boulevard, about six blocks from where the girl was attacked. He was seen going into his home, then, when police arrived, he jumped out a window, the prosecution said.

A crowd formed as he led police on a brief foot chase, then hid in a construction site. When officers pulled him out, the neighbors cheered.