MEXICO CITY (Reuters) - Mexico’s Senate on Thursday approved President Andres Manuel Lopez Obrador’s plan to create a new national guard, a central plank of the government’s strategy to subdue gang violence that has claimed tens of thousands of lives over the past decade.

A general view shows the Senate during a session to vote on the creation of a militarized police force, the National Guard, in Mexico City, Mexico February 21, 2019. REUTERS/Violeta Schmidt

The bill was passed unanimously by 127 senators but only after Lopez Obrador’s party agreed to put the new security force, which will be made up of soldiers and police, under civilian instead of military control.

The step caps weeks of wrangling over the so-called Guardia Nacional after initial plans to give the military control of the force met with resistance from human rights groups, opposition lawmakers and some close political allies of Lopez Obrador.

The change to a civilian-led force was part of a compromise from Lopez Obrador to win Senate support after he personally argued that generals should be in charge.

In a first phase, the guard will consist of some 50,000 members transferred from military and federal police forces.

Critics argued that giving control of the guard to generals would increase the militarization of Mexico, whose reputation has been battered in the past few years by notorious rights abuses carried out by security forces.

Lopez Obrador’s leftist National Regeneration Movement (MORENA) opted to modify the legislation, a constitutional change requiring a two-thirds majority in Congress.

“We need the support of the army and the marines to confront the grave problem of safety and violence,” Lopez Obrador said in a regular news conference ahead of the vote. “We’re going to guarantee peace and tranquility in the country because the people are asking for it.”

The legislation will now return to the lower house of Congress, where final approval should be a formality. It must then by ratified by a majority of state legislatures, most of which are controlled by MORENA and its allies.

Successive Mexican governments have tried to overhaul the security forces to tackle gang violence, which has been blamed for more than 250,000 homicides since former President Felipe Calderon sent in the army to take on drug cartels in late 2006.

Previous President Enrique Pena Nieto, who left office on Nov. 30, established a gendarmerie to oversee the fight against gangs, but that force was later massively scaled back.