Alan García, who has taken his own life aged 69, was a dominant, if divisive, figure in Peruvian politics for more than 30 years, during which he was twice democratically elected as president. His first stint in office, during which parts of the economy threatened to run out of control, was from 1985 to 1989. He then spent a decade out of power, for the most part in foreign exile, before re-election in 2006. During his second presidency García oversaw a more economically stable era until departing in 2011, but later was dogged by allegations that he had taken bribes while in office.

Born in the Peruvian capital, Lima, to Carlos García Ronceros, an accountant, and Nytha Pérez Rojas, a teacher, García was politically active from an early age, when he and his father were involved in the American Popular Revolutionary Alliance (APRA), a leftwing nationalist grouping founded in the 1920s. After studying law at the Pontifical Catholic University of Peru, the National University of San Marcos and for a period in Spain, he rose to become the party’s general secretary from 1983 until 1985.

Seen as a firebrand who would bring energy and new ideas to government, during his first presidency García greatly increased public spending and adopted a pugnacious approach to foreign creditors, declaring that Peru would not spend more than 10% of GDP towards repaying its foreign debts.

Perhaps his most controversial move came in 1987 when he tried to nationalise the country’s banking system. He also brought in the army to combat the millenarian guerrilla movement Sendero Luminoso (the Shining Path), an action that led to accusations that the state security forces had committed human rights abuses, including the summary execution in 1987 of several hundred political prisoners.

By the end of García’s first term in 1989, inflation was running at an estimated 7,000%, the banks were in crisis, middle-class Peruvians had seen their savings decimated and he was one of the most unpopular leaders in modern Peruvian history. He was replaced by Alberto Fujimori, who brought in austerity measures and reversed many of García’s social policies, which led to great animosity between the two men.

In 1992 Fujimori staged a coup by shutting down Congress and the judiciary, prompting García to go into hiding. He claimed this was because his name was on an assassination hit list, although his political opponents suggested it was more likely he was hiding from corruption charges. García eventually managed to find asylum in Colombia, then spent a lengthy period of exile in Paris, where he had studied sociology for a time at the Sorbonne in the 70s.

When democratic rule was restored after Fujimori was ousted in 2000, García went back to Peru in 2001 and stood in the presidential elections the following year, losing in the second round to Alejandro Toledo. He returned to the fray in 2006, when he was elected on a far more moderate platform, this time encouraging foreign investment and overseeing a boom in Peru’s mining sector and its economy in general.

However, it was during his second presidency that he and his associates allegedly took $29m in bribes from the Brazilian construction conglomerate Odebrecht to win lucrative contracts, in particular for the building of Metro line 1 in Lima. A spectacular emblem of his period in office was the construction of a giant replica of Rio de Janeiro’s Christ the Redeemer statue on the coast of Lima, dubbed locally “the Odebrecht Christ”. The issuing of pardons to several hundred convicted drug traffickers also muddied his reputation.

García stood again for the presidency in 2016, but by then his influence was on the wane and he won only 6% of the first-round vote. The Odebrecht scandal broke that year, and, although García denied any involvement, in November 2018 the judicial authorities barred him from leaving the country while he was being investigated. He sought refuge in the Uruguayan embassy, and asked for asylum. This was refused in December, and on 17 April this year a judge ruled that García should be brought into detention for questioning. He shot and killed himself at his home before he could be taken into custody. He had repeatedly maintained his innocence, stating on the day before his death that there was “no clue or evidence” of his involvement in any corruption.

García is survived by his second wife, María del Pilar Nores Bodereau, from whom he was separated in 2010, and by six children: four with María, one from his first marriage, to Carla Buscaglia Castellano, which ended in divorce, and another from a relationship with Roxanne Cheesman.

• Alan Gabriel Ludwig García Pérez, politician, born 23 May 1949; died 17 April 2019