Just before 10am on New Year’s Eve 1986, armed men arrived at the office of a small organisation for the resettlement of migrants, in Santiago, Chile. They immediately began rounding up staff. “They tossed us in the meeting room, on the floor, face down. They cut computer cables and tied us up, wrist to wrist,” recalled Eliana Infante, one of the staff. “After they tied us up, they asked, ‘Which of you is the communist son of a bitch Roberto Kozak?’”

A tall, strikingly handsome and immaculately dressed man stood up. “That’s me,” he said, calmly.

Kozak was marched down a flight of stairs. With a machine gun to his head, he was forced to lie on top of a conference table while he was interrogated by the paramilitaries.

The gunmen were members of a rightwing death squad ultra-loyal to the Chilean dictator General Augusto Pinochet. They were looking for guns and money that they suspected were stashed in Kozak’s office: the Santiago branch of the Geneva-based Intergovernmental Committee for European Migration (ICEM). They were also looking for evidence that Kozak was implicated in an assassination attempt on Pinochet a few months earlier, which had left five of the dictator’s bodyguards dead.

In the days after that ambush, Pinochet’s security services had kidnapped several high-profile leftwing activists in Santiago and slit their throats. When the paramilitaries burst into the ICEM office, Infante and the rest of the staff feared that Kozak was about to be murdered – and that after killing him, the armed men would set fire to their office, leaving them, tied up on the floor, to burn to death.

Under interrogation, Kozak insisted that the Santiago office was only involved in helping refugees, and that there were neither guns nor large amounts of cash on the premises. After an hour, Kozak was released, physically unharmed, and hurried upstairs to untie his staff. “He was green. It was a colour between yellow, white and green,” said Infante. “But poker-faced, he went downstairs, calmly called Geneva to inform them of the raid and then went on with his work.”

Roberto Kozak’s is one of the great untold stories of the 20th century. Diplomatic colleagues who know the full details of what he did during the Pinochet era referred to him as “Latin America’s Schindler”. Like Oskar Schindler, the German businessman who helped to save 1,200 Jews in Poland during the second world war, Kozak’s story is that of a man who courageously used his position to save lives. He could easily have kept his head down while thousands were taken prisoner, tortured or “disappeared” by Chile’s brutal military and secret police, but he chose not to. In the years following the 1973 military coup, Kozak and diplomats from other countries helped an estimated 25,000-35,000 Chilean political prisoners escape from captivity and find safe haven abroad.

More than a decade before the raid on his office, Kozak had worked his way into the inner circles of the Pinochet regime, courting senior military figures, politicians, officials and members of the secret police. Deploying a combination of diplomatic charm, patience and crates of imported whisky, he set about painstakingly negotiating the release of detainees, almost all of whom were from the Chilean left. He even hid some of them in his own house. Kozak brokered his deals in batches, sometimes scores or hundreds of prisoners at a time, sometimes just one or two.

When he died in September 2015, the world knew next to nothing of Kozak or his extraordinary legacy. Aside from a handful of articles in the local media and an honorary award from the Chilean government in 1992, there was no wider recognition. Kozak was self-effacing and reserved, and did not even tell his children of his actions until late in his life. His son Nikolai, who is now 24, knew little about Kozak’s work, until they attended the opening of Chile’s human rights museum – the Museo de la Memoria – in Santiago in 2010. That day, he glimpsed for the first time what his father had done.

As the ceremony unfolded in a packed plaza, Nikolai saw Kozak staring back at a figure who was looking at him from across the square. It was a shared look of astonishment. The two men slid through the crowd and, without a word, embraced. Both began to cry. For Nikolai, it was startling to see his father so emotional. Even more surprising was what the man – whose name was Patricio Bustos – said: “Your father saved my life.”

“I then realised my father was not the man I thought he was,” Nikolai recalled.

Roberto Kozak was born on 14 May 1942, in a rural village in north-east Argentina. His father’s family had moved to Argentina from Ukraine in the 1890s, while his mother, who also had a Ukrainian background, was from the capital city of Buenos Aires. One of 12 children, Kozak was still young when the family moved from the grind of agricultural life to a poor, working-class area on the outer rim of Buenos Aires. His father could only find odd jobs, so money was tight.

Aged nine, Kozak started working in a bookshop after school. The owner was to have a transformative influence on his life. He let Kozak look at the books when there were no customers, and the boy soon became an avid reader, discovering engineering and mechanics, but also international politics. He particularly loved an atlas full of facts and curiosities about faraway places. Throughout his teenage years Kozak combined work at the bookshop with classes, eventually enrolling to study civil engineering at the University of Buenos Aires.

After graduation, he worked at various technical jobs, and at 21 he married Elsa Beatriz, the daughter of Polish immigrants. In the late 1960s, the couple had a son, Sergio. When he was two, the couple split but remained in touch. (Kozak met his second wife Silvia in 1976, at a seminar in Buenos Aires. The couple had a son, Nikolai and a daughter, Nathalie, now 21.) Around the time of the break-up of his first marriage, Kozak changed careers. He was looking for a chance to see the world.

One day in 1968, Kozak spotted a newspaper advertisement for a vacancy at the Argentinian office of the ICEM. The ICEM was set up in 1951 to help people displaced by the second world war. When Kozak was hired, its scope was limited, but today, the International Organisation for Migration, as the body is now known, has 165 nation-members and operates under the umbrella of the United Nations.

After two years in Argentina, in 1970 Kozak began preparing for an international role with the ICEM, spending six months in West Germany training to be a diplomat and a further two in London learning English. He worked in the ICEM’s Geneva office for about two years on migration programmes for Latin America, before accepting a transfer to Chile.

Soon after his arrival in Santiago in May 1972, it became apparent to him that a coup against Salvador Allende’s Marxist government was coming. There were food shortages, strikes and increasing signs of unrest in the military. Kozak’s diplomatic contacts confirmed to him the widespread belief that the US was secretly using the CIA to undermine the government. The coup began at 7am on 11 September 1973. By that afternoon, the presidential palace had been stormed, Allende declared dead and Pinochet’s military junta had announced that it was in charge.

To many in Chile, the coup was not unexpected, but the ferocity of the military crackdown in its aftermath came as a shock. Pinochet and his inner circle saw the overthrow of Allende as not just an opportunity to impose stability, but a chance to remove what they been taught was a cancer at the core of society: Marxism.

Immediately, the military and secret police began commandeering farmhouses, private homes and even the national football stadium for use as detention centres. Among those detained were communists, socialists, students, journalists, priests and musicians. Any connection to the Chilean left or suspicion of involvement in organised opposition to the coup was taken as grounds for detention. Death squads made up of heavily armed combat troops travelled throughout northern Chile, rounding up villagers and leaving behind a trail of corpses. Between 1973 and 1978, about 70,000 people were detained, of whom an estimated 30,000 were tortured and approximately 3,500 killed.

General Pinochet and his Junta at a ceremony in Santiago, in 1985. Photograph: STF/AFP/Getty Images

From the ugly first days of the coup, Kozak was determined to do something for those trapped by the Pinochet regime. The work he had been doing before had been largely mundane, setting up small-scale migration programmes for people moving to South America and organising transport for new arrivals. Kozak realised from the outset that if he was going to be able to help, he would have to stretch the interpretation of his duties with the ICEM.

“He had to do something and not be passive. He thought organisations such as the ICEM should offer protection to people,” Kozak’s widow Silvia said. That meant becoming an active participant in the campaign to help those on the receiving end of Pinochet’s brutal crackdown. At the time, the ICEM was a risk-averse organisation, wary of controversy and fearful of offending member governments. It is likely that senior staff in Geneva were not fully aware of what Kozak was doing and, according to some present staff, that they would have been concerned had they known.

One of Kozak’s first moves was to establish tight working relationships with diplomats from sympathetic embassies. “Roberto undertook a great task but he did not do it alone,” Silvia stressed. “He was part of a network. He would have considered it egocentric to claim responsibility. He felt his task was important but he never took centre stage. He put great value on teamwork.”

One of the most courageous of the diplomats, who worked alongside Kozak in the immediate aftermath of the coup, was the late Swedish ambassador Harald Edelstam. During the second world war, Edelstam had helped Jews escape from Norway to Sweden. Now, in Chile, he was working to save people from Pinochet’s regime.

In one notable incident, Edelstam came to the rescue of hundreds of Cuban diplomats and Allende supporters trapped inside the Cuban embassy in Santiago, which was under fire from Chilean tanks and troops who were preparing to storm the building. Carrying only a Swedish flag, Edelstam went into the embassy and helped negotiate safe passage for the 147 Cuban diplomats. After having escorted the diplomats from the building, Edelstam then returned to sleep there that night, in order to protect the Chileans wanted by the regime. Before the end of 1973, Edelstam was declared persona non grata and expelled from Chile.

Although Italy had cut ties with Chile after the coup, it kept diplomats in Santiago. The Italian embassy provided sanctuary for 750 people escaping persecution. The US, meanwhile, had a conflicted approach to Chile: while the CIA backed the coup, some members of the state department were appalled by the events that followed.

Kozak worked with other diplomats and Catholic human rights organisations, such as the Vicariate of Solidarity, to share lists of people detained by the regime. Together, Kozak, the diplomats and the Vicariate quickly became a contact point for anguished relatives hunting for the missing. Kozak would attempt to visit specific detention centres to track down individual prisoners. He managed to get into some, but was always barred from those in which the interrogations and torture were most brutal.

To his staff, Kozak always seemed preternaturally calm. “He was always composed. It was remarkable,” said Infante. “He would come to the hot and stuffy third floor to inspect the files. We were all sweating and he’s in a jacket and tie, cold as a fish. He told us that the files must be carefully taken care of, that they were not files, they were human lives, worthy of respect.”

Emilio Barbarani, one of the Italian diplomats in Santiago at the time, became close to Kozak. According to Barbarani, who is now 76, Kozak’s main role was befriending senior figures in the Pinochet regime and winning them over in order to secure the release of detainees. Once a detainee had been released, Kozak then had to organise their travel to safe havens abroad by persuading foreign embassies to grant them a visa. The first stage in this process sometimes involved Kozak picking up the released prisoner from outside the detention centre. This had to be done to prevent them from being instantly recaptured or “disappeared”. Then Kozak would shelter them in his office or home while he tried to secure their escape from Chile.

Pinochet’s soldiers carry out mass arrests a few weeks after the coup in 1973. Photograph: Keystone-France/Gamma-Keystone via Getty Images

Barbarani is among those who see a parallel between Kozak and Schindler. “Roberto was a success with girls,” he said. “He was well-dressed, well-paid. He did not need to take political risks. It was not his job to do this. He did it because he was courageous.”

Kozak also had to escort freed detainees to the airport, which was controlled by the Chilean secret police. As often as possible, he would walk his charge across the asphalt, all the way to the door of the plane. In 1979, he helped spirit away to France Jose Zalaquett, one of the best-known human rights lawyers in Chile. Zalaquett remembers Kozak taking him to the airport. As they parted “he slipped a couple of hundred dollars in my pocket”.

Well aware of its limitations in Pinochet’s Chile, Kozak used his diplomatic immunity sparingly and just hoped that the deals he had made with the junta would hold. While some in the regime were prepared to tolerate what Kozak was doing, others were resentful of his interference in Chile’s domestic politics. According to those who worked with Kozak, Manuel Contreras, the head of the secret police, took a particular dislike to him. “I often talked with him about the risks,” said Barbarani. The Chilean secret police, Barbarani pointed out, did not respect the niceties of diplomatic immunity.

Among his staff and fellow diplomats, Kozak’s work ethic became legendary. He would begin early in the morning – often having already been to the airport to see off a detainee, or having spent the night in the office safeguarding a released prisoner – and he would finish late. And then there were the parties.

One key to Kozak’s success in securing the release of so many prisoners were the late-night gatherings he hosted at his stylish home in the La Reina neighbourhood of Santiago. Night after night, Kozak invited senior members of the secret police, army generals and foreign diplomats to meet over whisky and cocktails. As the drinks flowed, he would get officials to sign expulsion orders for detainees. He would also use the parties to find out where certain prisoners were being held and which embassies were processing visas, which allowed him to begin negotiations for exit papers.

The ICEM’s drivers often arrived at the office in the morning puffy-eyed, after working all night as waiters at one of Kozak’s parties. “There was a curfew, but not for the junta,” said Infante, remembering Kozak’s lobbying methods. “Whisky was very important. Every decree required a separate negotiation session.”

Throughout the dictatorship, which lasted until 1990, Kozak led a double life. “While Roberto was having a party for the military officials in his house, there would be refugees and political prisoners hiding in the attic,” Infante recalled. “He was always playing with fire.”

Entertaining guests in his apartment, he was acutely aware of the refugees hiding in the room above, but Kozak managed to master his fears about would happen to him if his secrets were revealed. Asked how he pulled off the multiple roles, Infante said: “Years later, when I asked him what he would have liked to have been in life, he said an actor – in theatre.”

Within a few years, Kozak’s contacts in the military junta went all the way to the top. A declassified cable from the US embassy in Santiago in April 1978 details a meeting between Kozak and Pinochet himself. “Kozak gave us an optimistic read-out on his April 14 meeting with President Pinochet and justice minister [Monica] Madriagada,” it said.

At his famous parties, Kozak constantly impressed upon his guests that Chile’s global reputation was suffering because of the regime’s widespread abuse of human rights. He also told them that they could help mitigate this by releasing prisoners. He made the same pitch to Pinochet. If the dictator was prepared to release dozens of political prisoners, Kozak would publish a statement to the press praising the move as an improvement in the country’s human rights record.

Despite his outwardly calm appearance, Kozak did suffer acute stress. According to Silvia, her husband was affected not only by the personal risk he was undertaking, but by the stories of torture he had to hear almost every day. His efforts on behalf of detainees did not always succeed, either, and he was especially troubled by the lives he did not manage to save. One of the incidents he regretted most was his failure to prevent the murders of José Hernán Carrasco Vásquez and Humberto Juan Carlos Menanteau Aceituno, leaders of Movimiento de Izquierda Revolucionaria (MIR), a leftwing movement largely made up of students and trade unionists.

The two men were arrested by the secret police in 1974. Kozak helped to negotiate their release in September 1975, but his attempts to secure them visas for France were held up by repeated bureaucratic delays. In November, the two men were captured by secret police once again and taken to an unknown location. One morning, the following month, Kozak was told that they had been found dead, their bodies showing signs of torture. The same morning he opened his mail to find authorisation for their visas.

The most notorious of the Pinochet regime’s detention centres was the Villa Grimaldi, a remote farmhouse on the outskirts of Santiago that had been taken over by the secret police – the Dirección de Inteligencia Nacional (Dina) – after the coup. Villa Grimaldi was usually the first stop for those arrested by the police or military: a place where people accused of subversion were held without trial, and interrogated about the names and locations of their leftwing allies.

Villa Grimaldi was run by Major Marcelo Moren Brito, a former military officer who had joined the secret police after the coup and became one of its most remorseless interrogators. About 4,500 people were held at Villa Grimaldi. Most were tortured. About 200 died, either from injuries sustained through torture or lack of medical treatment. Others simply “disappeared”.

Among those interrogated there was Michelle Bachelet, who is now president of Chile. Bachelet’s father had been a brigadier general in the Chilean air force and had served in the Allende government. He was detained and in March 1974 died from a cardiac arrest, probably after repeated torture. Ten months after his death, in January 1975, Bachelet, who was a university student at the time, and her mother, Jeria, were arrested, blindfolded and taken to Villa Grimaldi.

Jeria, who is now 90, was questioned by Brito. “He took my shoulders and began groping me,” she recalled. “My hands were tied behind my back and I could not defend myself. I said: ‘Major, behave yourself,’ and he did.” For Jeria, the most painful part of the detention was not knowing what was happening to her daughter. Ten days after arriving at Villa Grimaldi they were briefly reunited. “I was always blindfolded but we could feel each other’s presence.”

Bachelet, who was also interrogated, was released before her mother. Once outside, she contacted both Kozak and family friends in the air force to see if they could help get her mother out. Kozak went to the Australian embassy to ask for a visa for Bachelet and her mother, and in May 1975 accompanied them to the airport for their flight into exile. To this day, Jeria said, she and her daughter have not talked to each other about what happened to them at Villa Grimaldi.

Rodrigo del Villar Cañas was a geography student who had joined an MIR cell established before the coup. On 13 January 1975, soldiers arrested Villar and his brother at their home. Villar, who was 21, was held at Grimaldi for 15 days. He was interrogated by Brito and repeatedly tortured. One of the most feared techniques was being tied to a grille, similar to a metal bedstead. “My arms and legs would be tied to each corner,” Villar said. “They would then wet my body with water. There was a crank to generate electricity and they had a wire to hold against your ears, mouth, testicles, penis.”

After his spell at Villa Grimaldi, Villar was transferred to other detention centres, ending up at Puchuncaví in Valparaiso province. While there, Villar’s mother and sister got word to him that a man named Roberto Kozak had been helping negotiate the release of prisoners, including himself. On 1 May 1976, Kozak arrived to pick up Villar and two other people. “You are coming with me,” Kozak told him.

Villar was taken aback and at first was even resistant to leave: the outside world was uncertain, there was the danger of being arrested again and a sense of solidarity in the detention centre. Nonetheless, he got into Kozak’s car. “Kozak drove the 100 miles back to Santiago, with a policeman in the passenger seat and me and the other two prisoners in the back,” said Villar. “I had slept in the detention centre on a mattress half-an-inch thick. The backseat felt so soft. It felt like floating on cotton wool. He offered me a Dunhill cigarette. It felt great. The cigarettes we had in the camp were a load of shit.”

Villar believes that Kozak saved his life. “If he had not got me out? Quite simply, we would not be having this conversation,” he said. As a member of the armed resistance, Villar was ineligible for many refugee programmes overseas. Eventually Kozak persuaded Sweden to provide him with a visa, drove him to the airport and ensured that he boarded the plane safely.

Kozak can be seen in the background of many famous photographs from the darkest years of the Pinochet regime. One of the best known is of the British doctor Sheila Cassidy, photographed at Santiago airport upon her release from captivity. Cassidy, who was 37 at the time, had been arrested in November 1975 for treating a leftwing activist suffering from a gunshot wound. She attributes her release to pressure from the British government, whose consul, Derek Fernyhough, had visited her in detention.

When she arrived at the airport in Santiago, she met Kozak for the first time and was suspicious, fearing he might be a Dina agent. His sense of indignation at the suggestion helped convince her that he was genuine. A photograph of them on the runway went around the world. Cassidy, who is now 79 and lives in Plymouth, says that she had looked at the picture a million times but had never known Kozak’s role in her release until she was contacted by the Guardian this year.

Kozak escorts British doctor Sheila Cassidy to the plane taking her out of Chile, in 1975. Photograph: Museo de la Memoria y los DDHH de Chile

Cassidy remembers Kozak as being “cool and unfriendly”, but understood this was due to his fear that, even at the last moment, she might be taken away by the secret police. “He was just shit-scared,” she said.

One of the cables from the US embassy in Santiago shows the scale of Kozak’s humanitarian work. The communication, dated 20 April 1975, estimates that his office was responsible for moving between 400-600 former detainees out of Chile each month. Included are lists of where people were resettled. In 1975, some of the most generous host nations were Chile’s neighbours Argentina and Peru, as well as France which took in 105, West Germany 104, Romania 328. Among the most hospitable of all was the UK, which welcomed 429 former detainees.

The UK has a mixed record on Chile. Edward Heath’s Conservative government, which was in place at the time of the coup, had been hostile to the Allende government, but when Labour took office in 1974, it cut off arms sales to the Pinochet regime and in 1977 withdrew its ambassador from Santiago. After Margaret Thatcher took office in 1979, diplomatic relations were restored, along with arms sales.

In 1998, while visiting the UK, Pinochet was placed under house arrest on an international warrant that accused him of human rights violations. Tony Blair’s Labour government was in power at the time, but Thatcher visited Pinochet in March 1999 at the rented mansion in Wentworth, Surrey, where he was being held. Many Conservative MPs voiced support for Pinochet, noting that he had been a friend to the UK during the 1982 Falklands war, and dismissed the attempt to have him extradited to Spain as a leftwing stunt.

Kozak left Chile in 1979 to return to Geneva as head of the ICEM department responsible for migration in Latin America. By this time, according to US cables, only 79 political prisoners remained captive. The junta had agreed to speed up releases if Kozak was willing to sign a declaration to the effect that there were no longer any political detainees left. Kozak signed the deal.

By 1980, much of the resistance to Pinochet’s government had been suppressed. Killings by the security services had become more targeted, allowing many exiled Chileans to assume they could safely return to their country. Kozak himself returned to Chile in 1984 and the following year was helping to bring back people who had fled Chile at the height of Pinochet’s repression. That, too, was a fraught process. Some in the junta argued that the return of exiles was good for Chile’s international reputation. Others feared that they could rekindle armed resistance. When, on 8 September 1986, members of a Marxist guerrilla group ambushed Pinochet’s motorcade in an attempt to assassinate the dictator, hardliners felt that their view had been vindicated.

The fact that there was a direct link between the ICEM and some individuals accused of involvement in the plot against Pinochet’s life was a big problem for Kozak. “The organisers were brought to Chile by our organisation,” said Infante. These former exiles had set up a bakery under a special programme run by the ICEM. “That bakery was financed with our money. So after the attack [the paramilitaries] went right to us.”

The raid on the ICEM office took a particularly tough toll on Kozak. For a long time after, “He would dream about it and wake with a start in the night,” Silvia recalled.

Kozak left Chile in 1991, the year after the fall of Pinochet’s regime, to establish a branch of the International Organisation for Migration (IOM) in Moscow. In 1994, he moved back to Geneva as the IOM’s chief of staff. Ten years later, when he finally retired, he settled not in his native Argentina but in Chile, the country that had defined his life and where he felt most at home.

In 1992, Chile awarded Kozak its highest honour, the Order of Bernardo O’Higgins, named after one of the leaders of the Chilean independence movement. Many of Kozak’s colleagues, and those he helped, felt that he deserved more, and were pleased when the Chilean government belatedly gave him citizenship last year.

Kozak had been living with cancer for at least a decade. Characteristically, he had not told many people, but when it became obvious that his condition was terminal, he flew to the Argentinian capital for specialist treatment. At the airport, Silvia, as usual, joined the queue for Argentine citizens. Having been granted Chilean citizenship only four days previously, her husband joined the queue for non-Argentines. “Are you crazy?” she asked him, looking at the length of the queue. Kozak was proud that he had become a Chilean and wanted to make that point, even if it meant standing in a longer queue.

Since Kozak’s death in September 2015, Silvia has kept his ashes in his study in their Santiago home. She intends to scatter them around Chile: in the foothills of the Andes, where they had a plot of land with breathtaking views of the mountains; by a lake where Sergio, his son from his first marriage, has a house and where Kozak had fond family memories; and, finally, by a tree planted by the farmhouse that was once a place of torture and death. The tree was planted in honour of Kozak by the Villa Grimaldi Foundation, an organisation set up to maintain the grounds as a memorial.

Chile has been slow to confront the Pinochet era, but some members of the regime have been tried and jailed. The former head of the secret police, Manuel Contreras, was handed a 529-year sentence for his part in the killings and torture. Brito, the torturer of Villa Grimaldi, was sentenced to 300-years. Since 1990, there have been only been 188 successful prosecutions in Chile, with 1,300 investigations remaining open, according to the Museo de la Memoria.

Michelle Bachelet studied medicine while in exile and returned to Chile in 1979. Standing on a socialist platform, she was elected president for a four-year term in March 2006 and again in March 2014. Her mother lives in a flat in Santiago.

Villar returned to Chile from Sweden with his family in 1991 and taught geography at the University of Chile. He is working on turning the Puchuncaví detention camp, where he met Kozak, into a memorial.

The last conversation Kozak and Silvia had was in a taxi on their way to the cancer treatment centre in Argentina. As they listened to radio news of the refugee crisis in the Mediterranean, which had been building that summer, he told her: “If I was young, I would be there.” Fifteen minutes later, he was dead.

Support for this article was provided by a grant from the Pulitzer Center on Crisis Reporting.

• Follow the Long Read on Twitter at @gdnlongread, or sign up to the long read weekly email here.