Mexico's Supreme Court invalidated a controversial law signed last year that created a legal framework for the military to work in a policing role in much of the country, ruling Thursday that the measure violated the constitution by trying to normalize the use of the armed forces in public safety.

Deep-rooted corruption and ineffectiveness among local and state police forces has led Mexico to rely heavily on the military to combat drug cartels in parts of the country.

But military commanders have long expressed uneasiness about what was essentially an open-ended policing mission. The armed forces have been implicated in a number of human rights abuse cases.

On Wednesday, President-elect Andres Manuel Lopez Obrador announced a security plan that would also lean on the military. He proposed forming a National Guard initially made up of elements from the navy and army police as well as federal police.

After drawing a raft of criticism, especially from human rights groups, Lopez Obrador sought on Thursday to distinguish between his plan and his predecessors'. He said congress would seek a constitutional reform to allow it.

"Because I don't want to use the army and the navy like they have been doing for public safety work if they are not authorized to carry out those functions," Lopez Obrador said.

But the international human rights group Amnesty International said the Supreme Court's decision should cause Lopez Obrador to rethink his security plan.