Mexico's Supreme Court has declared unconstitutional a key portion of a military law which has broadened the influence of military courts and angered civilian victims seeking justice.
The 8-2 ruling said a provision of the Code of Military Justice that claims authority over all crimes committed by soldiers on duty is incompatible with Mexico's constitution.
The ruling said it violates a federal law stipulating that military courts should not expand their scope over civilians affected by a case.
The court's majority ruled that soldiers arrested as suspects in the killing of Bonfilio Rubio, an indigenous man of southern Mexico, should be transferred to a civilian court.
Mr Rubio died in June 2009 after soldiers opened fire on a bus that he was travelling in at a checkpoint near the town of Huamuxtitlan.
"When a person outside the military is either the defendant or the victim, an ordinary judge has authority over this case, not a military judge, the constitution says it," said Justice Luis Maria Aguilar.
A part of the military code says all crimes committed by soldiers on duty are considered crimes against military discipline.
The provision has been subject of scrutiny because human rights activists claim it has long allowed security forces to take over cases of fellow soldiers accused of abusing, torturing and executing civilians.
Rights groups and Mexican news media obtained records that showed military prosecutors opened nearly 5,000 investigations into alleged violations of human rights between 2007 and April 2012, but only 38 service members were convicted and sentenced.
The number of complaints has increased since President Felipe Calderon deployed tens of thousands of soldiers to crack down on drug traffickers.