Mexico’s president said Wednesday he opposed the criminal charges filed against former U.S. President Donald Trump, suggesting they were brought for political reasons during an electoral campaign.

Trump, who is campaigning to regain the presidency in the 2024 election, pleaded not guilty Tuesday to 34 felony counts related to hush money payments made during the 2016 campaign.

“Legal, judicial issues should not be used for political, electoral purposes,” Mexican President Andrés Manuel López Obrador said at his morning news briefing.

“I don’t agree with what they are doing to former President Trump.”

López Obrador had a strangely warm relationship with Trump in 2019 and 2020, despite the former U.S. president’s frequent criticisms of Mexico and migrants, and his plans to build a wall between the two countries.

Analysts say Trump and López Obrador share an essentially transactional view of politics, in which making a deal and sticking to it is highly valued.