LIMA, Peru - A judge granted parole Tuesday to Lori Berenson, a New York activist who has spent 15 years in Peruvian prisons for aiding leftist rebels.

Judge Jessica Leon granted Berenson's request for conditional release during a hearing at the Lima prison where the American is being held. She said Berenson, 40, could not leave Peru until her 20-year sentence for terrorist collaboration ended in November 2015.

Berenson, who gave birth to a son last May, nodded assent but did not speak when asked by the judge whether she accepted the decision.

"I'm happy with the sentence because justice was done," said her lawyer, Anibal Apari, who is also the father of Berenson's child, Salvador.

Apari said Berenson, whom he met in prison and married in 2003, would be freed within 24 hours. Their son has been living with his mother in prison.

Apari is a former member of the Tupac Amaru Revolutionary Movement, or MRTA, the now-defunct leftist band that Berenson was convicted of helping.

The judge's decision, read by a clerk, said Berenson had "completed re-education, rehabilitation and re-socialization" and demonstrated "positive behavior."

Berenson had said in her parole request that she planned to work as a translator if released. Her defense team said she "recognized she committed errors in involving herself in activites of the MRTA."

Berenson had long denied any wrongdoing and maintained that she was a political prisoner.

The daughter of two Ph.D.s, Berenson dropped out of the Massachusetts Institute of Technology in 1989 to pursue a passion for social justice. After working in Central America, she traveled to Peru in 1994.

She was arrested in 1995 and accused of aiding Tupac Amaru, which bombed banks and kidnapped and killed civilians but was not as violent as the better-known Shining Path insurgency.

Police contended that she helped to coordinate Tupac Amaru activities and obtained weapons for the group. A military court convicted her in 1996 of terrorism,

A civilian court retried Berenson in 2000, convicting her of the lesser crime and reducing her sentence to 20 years.

Telephone messages left with Berenson's parents and lawyer in the United States seeking comment were not immediately returned.