SAN JUAN, Puerto Rico — Three men who spent more than 20 years in prison for murder were freed Tuesday in a historic ruling after new tests found none of their DNA on evidence in a case that captivated the U.S. territory.

Nelson Ortiz, Jose Caro and Nelson Ruiz hugged loved ones tightly after prosecutors requested that charges be dropped due to a lack of evidence. The men had repeatedly sought a new trial after they were convicted in 1995 in the killing of 21-year-old pharmacy student Glorimar Perez.

On Tuesday, Judge Jose Emilio Gonzalez asked that the men approach the podium in front of a packed courtroom.

“You are finally free to go and give life the best of you,” he said.

The men nodded seriously, while some in the crowd erupted in brief applause. All three had been out on bond since June, and the judge ordered that their ankle monitors be removed.

The men are the first in Puerto Rico to have a conviction thrown out under a law approved in December 2015 that allows convicts to request DNA analyses on new evidence or on evidence that was never analyzed or questioned at trial.

They were the first to invoke the new law with help from the Interamerican University’s Innocence Project.

Ruiz told The Associated Press in a phone interview that the first thing he plans to do is reconnect with his daughter and other family members.

“That’s the only thing I have left,” he said. “This will help me grow as a person and as a man, because after 28 years of humiliation, the truth is finally known.”

The three men were arrested five years after Perez was found shot to death along Puerto Rico’s northwest coast in July 1988. The men had no criminal record, and suspicion fell on them apparently based on circumstance. Just months after their conviction, the key witness recanted, saying he had falsely implicated the three in a plea bargain exchange for immunity on other unrelated charges he faced.

However, appeals court judges repeatedly denied the men’s requests for a new trial until this year, when the results of the DNA evidence were revealed.

Justice Secretary Cesar Miranda said it would be inappropriate to hold a new trial because the evidence in the case had “suffered the unforgivable brunt of time.” He also acknowledged that the victim’s family has been traumatized by developments in the case.

Doris Perez, one of the victim’s sisters who lives in the U.S. mainland, told the AP that she does not believe the three men were framed.

“My sister is dead; nothing changes for me or my family,” she said.

Ruiz lamented that a new trial was not held.

“There will always be people who will doubt me, and I can’t do anything about that,” he said. “I had no fear over facing a new trial. Quite the opposite. That’s what I wanted.”

Danica Coto on Twitter: