She started out as a passionate fighter for social justice and democracy. She ended up on the front lines of one of Latin America's bloodiest civil wars, to be arrested and jailed for life for terrorism. Now, after 15 years behind bars, the ordeal of Lori Berenson is almost over.
A judge this week in Lima ordered that Ms Berenson, now 40 and the mother of a one-year-old son, should be released on parole. She must stay in Peru for rest of her sentence. But barring the unlikely event that the ruling is overturned on appeal, finally she will be free.
Ms Berenson's story is entwined with the turbulent history of modern Peru. The daughter of two New York college professors, she was a crusader for social justice who dropped out of the prestigious Massachusetts Institute of Technology in Boston to join left-wing radicals fighting for democracy in San Salvador.
She moved on to Peru in 1992, where she fell in with senior figures in the Tupac Amaru Revolutionary Movement, or MRTA, a Marxist rebel group named after the last leader of the Incan state, fighting the government of Alberto Fujimori.
Between 1980 and 2000, Peru was racked by a savage and chaotic guerrilla war that claimed some 70,000 victims. In fact, the MRTA, though blamed for 1,000 deaths, was a relatively minor actor. Far more murderous were the Maoist group The Shining Path and Mr Fujimori's ruthless security forces.
In November 1995, Ms Berenson was arrested on a bus in Lima and convicted by a military tribunal of leading a terrorist group. So dangerous were the times that the judges wore hoods and spoke though voice distorters, to avoid being recognised and murdered in reprisal. Although she maintained her innocence, Ms Berenson was sentenced to life in prison for setting up a safe house for MRTA leaders and plotting an attack on the national parliament.
In a Peru where Mr Fujimori was still highly popular, most people had little sympathy for her. For her critics, she was a left-wing fanatic who at the very least had consorted with rebels, and had basically got what she was asking for.
But for her supporters abroad Ms Berenson was the victim of a kangaroo court run by a brutal dictatorial regime.
In 1998 Amnesty International declared her a political prisoner, and intense efforts to obtain her release won her a retrial in 2000 before a civilian court. Once again, she was convicted, but this time on the lesser charge of collaborating with terrorists, and sentenced to 20 years in prison.
Even so, demands for her release continued, especially after Mr Fujimori's rule ended in disgrace and flight to Japan, from where he faxed his resignation back to Lima. Nonetheless, while recognising irregularities in her trials, the Inter-American Court of Human Rights ruled in 2004 that Ms Berenson must serve out her term.
Normally, she would not have left jail until 2015. For the last five years, however, she helped run a prison bakery, proof of good conduct that may have hastened her release. In the ruling, Judge Jessica Leon said that Ms Berenson had completed her "re-education, rehabilitation and re-socialisation" and was now showing "positive behaviour".