PHILADELPHIA —A man long considered the prime suspect in the disappearance of a New York City boy more than three decades ago was released from a Pennsylvania prison on Wednesday and then was immediately arrested on a Megan’s Law violation after providing an outdated address of where he would be staying, State Police said.

Jose Antonio Ramos was taken into custody following his release from a northeastern Pennsylvania prison where he had spent more than 20 years for molesting children, according to State Police and the New York Police Department.

Sex offenders are required to provide their addresses, and the one Ramos gave was false, they said.

Pennsylvania State Police Lt. Richard Krawetz and chief NYPD spokesman Paul Browne said Ramos gave a Bronx address of a relative from more than 30 years ago and, while the address exists, the relative hasn’t lived there for years.

“When he walked out of the main gate, he was taken into custody by troopers,” Krawetz said.

NYPD special victims detectives looking into the matter said the cousin told them she would not let Ramos live with her because she and her family were frightened of him when he would visit the apartment 35 years ago.

Ramos had long been suspected in the disappearance of 6-year-old Etan Patz, who vanished May 25, 1979, after leaving his Manhattan home to go to a bus stop two blocks away. It was the first time Etan’s parents had let him go off to school alone.

Ramos had been dating Etan’s baby sitter. He later served the time in Pennsylvania for molesting two other boys.

Earlier this year, a new suspect named Pedro Hernandez was charged with Etan’s murder after police said he confessed. Hernandez’s attorney, Harvey Fishbein, has said Hernandez, of Maple Shade, N.J., is mentally ill, and authorities have not cited any additional evidence to implicate him beyond his own admission.

Etan’s disappearance prompted a massive search that stretched as far as Israel and spawned the national movement to publicize the cases of missing children. His photo was among the first put on milk cartons, and his case turned May 25 into National Missing Children’s Day.

His parents never moved or changed their phone number, in case he returned. In 2001, they obtained a court order declaring him dead. They have become outspoken advocates for child protection issues.

Ramos was declared responsible for Etan’s death in a civil court in 2004, but the Manhattan district attorney’s office has said there wasn’t enough evidence to charge him criminally. Ramos has denied any involvement in Etan’s disappearance.

Prosecutors are expected this month to announce whether they believe there’s enough evidence to continue pursuing a case against Hernandez, who worked at a convenience store near Etan’s home when the boy disappeared and told police he strangled the boy and stuffed his body in a trash bag.

Failure to provide accurate information when residing as a sex offender is a felony under Pennsylvania law, police said.

Associated Press writer Colleen Long contributed to this story from New York.