Mexican lawmakers have approved a reform of the body which oversees elections, a move which critics say will weaken and undermine it.
The overhaul of the National Electoral Institute (INE) has been driven by President Andrés Manuel López Obrador, who has accused it of being partisan.
The move will slash INE’s budget. reduce its staffing and lead to the closure of many of its local offices.
Opponents of the measure have called for protest marches on Sunday.
The Senate approved the reform with 72 votes in favour and 50 against. The Chamber of Deputies had already passed it, which means that it will come into force once it is signed by President López Obrador.
The BBC’s Mexico correspondent, Will Grant, says it is perhaps the most polemic political issue in Mexico at present.
Mr López Obrador, who was elected in July 2018 after two previous failed attempts, has long been critical of the INE, whose staff oversee elections.
Last month, he lashed out against the independent body, accusing it of cheating as well as arguing its staff turned a blind eye to “the stuffing of ballot boxes, falsification of [election] records and vote buying”.
“Let them go cheat somewhere else, they just want to keep stealing [votes],” he said.
The president’s contempt for the INE is not new, it dates back to his first attempt at becoming president in 2006.
Back then, he lost to his conservative rival Felipe Calderón by less than one percentage point. For months, Mr López Obrador refused to recognise the result, which he denounced as fraudulent.
He also challenged the result of the 2012 election, when he lost to Enrique Peña Nieto.
Since his win in 2018, Mr López Obrador has been pushing for a reform of the INE, which he says will save taxpayers $150m (£125m) a year by drastically reducing the agency’s staff.
The measure passed on Wednesday is a watered-down version of the reform he originally proposed, which failed to make it through Congress.
Even though the new version, dubbed “Plan B”, is less drastic than the original proposal, it has caused an outcry among opposition politicians who say it is a setback to Mexico’s democratic institutions.
They have called for mass protests to be held on Sunday.
The measure is also facing legal challenges, with the head of the INE saying he would take it to the Supreme Court.