LIMA, Peru — A former president of Peru died on Wednesday after shooting himself in the head when the authorities tried to arrest him in connection with one of the biggest corruption scandals in Latin American history.

When the authorities arrived at the home of the former president, Alan García, with an arrest warrant, he locked himself into his bedroom, shot himself and was rushed to a hospital, his personal secretary told reporters.

The charges relate to Odebrecht, a Brazilian construction giant, which last year admitted to $800 million in payoffs in exchange for lucrative contracts for projects including roads, dams and bridges. The company was a main builder across Latin America, where it profited from a commodities boom that led to a huge spike in infrastructure construction.

The revelation that Odebrecht had secured contracts through graft set off a flurry of investigations by prosecutors and lawmakers, principally in Latin America, as they sought to learn who was on the receiving end of the payments.