He was arrested, held and tortured during Argentina's Dirty War - an era of state-sponsored violence from 1976 to 1983, in which an estimated 30,000 Argentines were killed or disappeared at the hands of the military regime.

With this background, Mr Mendez, who has just published a book on the history of human rights around the world, understands the human cost of persecution all too well.

At the height of the repression, he was working as a young lawyer defending opponents of the military government.

As a result, he spent 18 months at a prison outside the city of La Plata in 1976, where he was tortured with an electric prod and watched friends being pulled from their cells and executed.

Since 2007, Argentine courts have successfully prosecuted 170 perpetrators of these atrocities.

Although it has taken a long time for the country to reckon with its past, Mr Mendez believes the Argentine experience has an important lesson to offer the world.

"Argentina is really showing that we don't have to live with impunity," he says.

There is generally an attitude that if torture keeps us safe then we don't really care about itJuan Mendez, UN rapporteur for torture

But the trials had a rocky beginning.

In 1983, civilian rule was restored and the prosecution of perpetrators of violence began.

However, three years later an amnesty law was enacted that protected the military.

Many argued the amnesty would foster a democracy without bitterness and help Argentina to move on but Mr Mendez disagrees.

"The most important argument about the Argentine experience of today is that these things don't go away.

"Thirty years later the wounds are still open, the victims are still there, they will continue to press and you will just have to deal with it later."

In 2007, the amnesty law was overturned and the trials began again in earnest.

At first they were slow-moving and disorganised but now both the Supreme Court and the prosecutor's office have made them a priority.

In October 2011, a court convicted one of the most notorious of the regime's murderers, Alfredo Astiz. He was a navy captain based at the Naval Mechanical School in Buenos Aires (Esma) which was the biggest secret torture and killing centre of the Dirty War.

Media playback is unsupported on your device

Media captionCrowds cheered when Alfredo Astiz was recently jailed for life

However not all the defendants have been successfully prosecuted. Recently one with a bloody record was acquitted. But for Mr Mendez, such outcomes are not a setback.

"The courts are living up to their responsibility to provide fair trials," he says.

"It is a victory for the law - the courts and prosecutors have been very systematic in respecting the rights of all defendants, even the most notorious of them."

The trials do have overwhelming public backing: in a recent opinion poll, more than 80% were in favour of them.

Esma torture chamber

Esma was the biggest secret torture and killing centre of the Dirty War.

Of the 5,000 or so prisoners taken there, 90% did not come out alive.

Some were killed by firing squad while others were thrown from planes - drugged but still alive - into the Atlantic Ocean.

More than 70 of those who did make it out were among the witnesses in the 22-month trial of Alfredo Astiz.

"The Argentine population has remained faithful to democracy, the most ungovernable kind of democracy is better than the worst kind of dictatorships," Mr Mendez says.

He believes it is this mission to find justice that has helped Argentine democracy through the greatest challenges of the past 30 years.

"We have had quite a bit of stability even in the worst-case scenarios, hyperinflation, default and a complete melt-down of the banking system in 2001.

"Greece is a playground compared to what happened in Argentina."

Facing up to the past

He also argues that the Argentine experience is one that many countries, especially the US, can take heed of.

"There are many countries where impunity reigns and I would say the most disappointing - obviously on a different scale - is the United States where the torture that has happened during the war on terror is not being investigated by political decisions not to investigate it."

"In the US there are civil society groups that pursue justice very valiantly but in terms of public opinion there is still this idea that these are people we don't care about, names we can't pronounce."

He added: "There is generally an attitude that if torture keeps us safe then we don't really care about it.

Yet there are countries, for example South Africa, Chile and Peru, that have tried or are trying to pursue justice for past wrongs.

Image caption
Argentina is still coming to terms with its past

"The attempt to prosecute and punish and to tell the truth is making more headway now than at any time. Thirty years ago it would have been impossible to predict that any country would try and do this," Mr Mendez says.

But does Argentina run the risk of getting too mired in its past and failing to look to the future?

"I don't think the 80% of people that are in favour of the trials will see it that way'," he says.

"Argentina has moved on, is moving on and in fact is moving on thanks to the trials not in spite of them. It is moving on to more respect for freedom of expression, freedom of association."

Juan Mendez is the UN's special rapporteur on torture, listen to him on BBC World Service's Outlook via iPlayer or download the podcast. His book, Taking a Stand: The Evolution of Human Rights is published by Palgrave Macmillan.