The former president of Peru, Alan Garcia, speaks during the First International Meeting of the Pacific Basin, in Cali, Colombia, on October 5, 2011.

Peru's former president Alan Garcia died in a hospital in Lima on Wednesday, hours after shooting himself in the head to avoid arrest in connection with a bribery probe, authorities said on Wednesday.

Garcia was 69.

A skilled orator elected president twice, first as a firebrand leftist and then as a champion of foreign investment and free trade, Garcia had been dogged by allegations of corruption in recent years that he repeatedly denied.

Garcia had been one of nine people a judge had ordered to be arrested on Wednesday for alleged involvement in bribes distributed by Odebrecht, a Brazilian construction company that triggered Latin America's biggest graft scandal when it admitted in 2016 that it had paid kickbacks to politicians across the region to secure lucrative contracts.

Members of his party announced his death to crowds gathered outside of hospital Casimiro Ulloa, where he suffered three cardiac arrests and underwent emergency surgery.

President Martin Vizcarra said on Twitter that he was "consternated" by Garcia's death, and sent his condolences to his family members.

Garcia governed as a nationalist from 1985 to 1990 before remaking himself as a free-market proponent and winning another five-year term in 2006.

He had denied wrongdoing involving Odebrecht, and blamed his legal troubles on political persecution.

"Others might sell out, not me," Garcia said in broadcast comments on Tuesday, repeating a phrase he has used frequently as his political foes became ensnared in the Odebrecht investigation.

Interior Minister Carlos Moran said at a news conference before Garcia died that the former president had told police he needed to call his attorney after they arrived at his home in Lima to arrest him.

"He entered his room and closed the door behind him," Moran said. "Within a few minutes, a shot from a firearm was heard, and police forcibly entered the room and found Mr. Garcia sitting with a wound in his head."

Last year, Garcia asked Uruguay for political asylum after he was banned from leaving the country to keep him from fleeing or obstructing the investigation. Uruguay rejected the request.

Garcia would have been the third former president in Peru to have been jailed in the Odebrecht case. Ollanta Humala spent nine months in pre-trial detention in 2017-2018 and Pedro Pablo Kuczynski was arrested without charges last week.

A fourth former president, Alejandro Toledo, is fighting extradition from California after a judge in Peru ordered him jailed for 18 months in connection with Odebrecht in 2017.

All have denied wrongdoing in connection with Odebrecht.

In Peru, criminal suspects can be ordered to spend up to three years in jail before trial if prosecutors can show they have evidence that likely would lead to a conviction and the suspect would likely flee or try to interfere in the investigation.