SAN ANTONIO — Tony Ayala Jr., a rising star in boxing before a 1983 rape conviction that led to the first of two long prison terms, died Tuesday at a family-owned gym in his hometown of San Antonio. He was 52.

Bexar County medical examiner records indicate Ayala died the gym where he was trying to build a career as a trainer. There was no immediate cause of death.

Ayala, a 1979 Golden Gloves middleweight champion, was 19 when he was arrested and later convicted of raping a schoolteacher in New Jersey. He was undefeated in 22 bouts with 19 knockouts and set to fight Davey Moore for a junior middleweight title before the arrest.

After serving 16 years of a 35-year term for rape, Ayala was involved in several incidents in Texas as he tried to revive his boxing career. He was shot in the left shoulder by a woman after allegedly breaking into her home and refusing to leave in 2000. He got probation and a short jail term in a plea agreement.

Four years later, Ayala went back to prison for 10 years when he violated parole in the Texas case. He was pulled over for speeding and charged with driving without a license, possession of heroin and possession of pornography.

Ayala also was charged in 2003 with having sex with a 13-year-old girl, but charges were dismissed when the girl said she lied about the incident.

"Tony had some rough edges," said Johnny Cisneros, his former defense attorney. "If you really, really got to know Tony, he was a nice guy. That sounds contradictory to some of the things that people have read and based on his criminal history. But as a friend, he could be a good guy."

Ayala was among four brothers who trained under their father, Tony Ayala Sr. The elder Ayala died of complications from diabetes in April 2014, about the time of his son's second release from prison.

Cisneros said he watched the Floyd Mayweather-Manny Pacquiao with Ayala earlier this month, and the attorney said he was hopeful his former client could rebuild his life as a trainer.

"In the sport of boxing, they scrutinize you, they might look bad upon you, but they need you," Cisneros said. "Because without a boxer, there's no show. And he was training boxers. So that's what he was trying to do. That's what I mean by trying to get his life on track."

Ayala's hometown fans gave him a standing ovation after a victory in 2001, just before he was to go to trial in the incident that led to him getting shot. Known as "El Torito" (the Little Bull), Ayala had a 28-1 record after that win.

"Sad for him in a sense that he could have been a multimillionaire," Cisneros said. "He could have been famous in another way, other than for being in trouble. And sad for the family because it's a good family."