FILE PHOTO: Former Brazil's President Michel Temer gestures during a ceremony to launch the new program of the Brazilian state development lender BNDES at the Planalto Palace in Brasilia, Brazil August 23, 2017. REUTERS/Adriano Machado/File Photo

SAO PAULO (Reuters) - Former Brazilian President Michel Temer has been formally charged with corruption on allegations of using a middleman to procure a suitcase full of cash from the world’s largest meatpacker, JBS SA, federal prosecutors said on Thursday.

Temer, who was president from 2016 until the end of 2018, was arrested last week as part of a separate investigation and accused of running a vast criminal enterprise that sought bribes for public works projects.

He denies all charges and was freed this week after a petition by his lawyers.

In 2017, Rodrigo da Rocha Loures was caught on video by security cameras running out of a Sao Paulo restaurant carrying a bag with 500,000 reais ($128,166) in cash that prosecutors said was a bribe from the owners of JBS.

Plea-bargain testimony by two executives of JBS holding company J&F Investimentos SA implicated Temer and other politicians in corruption and led prosecutors to accuse Rocha Loures of being a middleman for Temer, which the former president denied. Rocha Loures, who has also denied the charges, is awaiting trial.

On Thursday, Temer was officially charged by federal prosecutors with having received bribes paid by a JBS official and delivered by a J&F executive.

Temer’s lawyer, Eduardo Carnelós, said in a statement that the charges were part of a “sordid operation aiming to depose the former president of the republic.” He added that the charges were “devoid of any foundation.”