CNN  — 

The man accused of throwing a 5-year-old over a third-floor railing at Minnesota’s Mall of America pleaded guilty to the crime Tuesday, according to the Hennepin County attorney’s office.

Emmanuel Aranda, 24, struck a plea bargain to avoid trial, said Chuck Laszewski, a spokesman for the prosecutor’s office. The office intends to seek the maximum punishment for attempted first-degree murder, which is 19 years in prison, he said.

Sentencing is set for June 3.

As attorneys worked to hammer out the deal, Aranda conceded he intended to killed the boy, Laszewski said, recounting an exchange between the defendant and prosecutor.

“You didn’t just drop him; you threw him over,” prosecutor Cheri Ann Townsend said, according to Laszewski.

“Yes,” Aranda replied.

Emmanuel Aranda, 24, pleaded guilty to attempted murder, an official says.

The boy’s family gave the plea deal its blessing, Laszewski said.

“We were happy with this,” he said. “Even if we would have gone to trial, proven the case, the most he would have gotten would have been 12 months more.”

The public defender representing Aranda could not immediately be reached for comment.

On April 12, Aranda picked up the boy and threw him over a railing at the famed Bloomington mall, police said. The child plummeted 40 feet to the floor two stories below, suffering extensive injuries.

The boy, who has not been publicly identified, was with his mother outside the Rain Forest Cafe when Aranda approached them, according to a criminal complaint. The mother had never seen Aranda before, and she asked if she and her son should move.

That’s when Aranda picked up the boy and threw him over the railing, the complaint said.

Aranda told police he had come to the mall a day earlier to kill an adult, but that didn’t pan out, according to the complaint, so he returned the next day and attacked the boy instead.

Aranda told police he knew his actions were wrong, the complaint said. He had visited the mall for years trying to speak to women, but they rejected him, which made him lash out, he told police, according to the complaint.

Police and paramedics respond to the scene at the Mall of America on April 12.

The victim’s family announced in an April 26 statement that the boy was “alert and conscious” after spending two weeks in critical condition.

“All praise, glory and honor to Jesus! He saved our son’s life and is healing him in the most miraculous ways. We are so elated to let you know that our son is now alert and conscious and is no longer in critical condition!,” the family said in a statement.

Though the boy is expected to require additional surgeries and rehabilitation, the family said he should be released from the hospital by June.

“The child continues to heal and the family asks for continued prayers and privacy,” a communications firm representing the family said Tuesday.

CNN’s Nicole Chavez and Sheena Jones contributed to this report.