Blood is seen on the wall of a building in the Tlatlaya community after 22 people

A Mexican judge has ordered the release of four of the seven soldiers charged in the killing of eight gang suspects in a high-profile case last year.

The attorney general's office said Monday it would appeal the court's ruling.

The judge ruled last Thursday that there was not enough evidence to put the four soldiers on trial on charges of "actions improper to public service" for attempting to cover up the killing, their lawyer said.

The three other soldiers have been charged with murdering eight of 22 gang suspects killed in a warehouse in the municipality of Tlatlaya on June 30, 2014.

The seven suspects, including an officer, still face military charges.

The army initially said the 22 suspects were killed in a shootout. But a survivor later told Esquire magazine that the suspects had surrendered before they were executed.

The National Human Rights Commission concluded that at least 12 suspects were extrajudicially killed, but federal prosecutors charged the soldiers for the deaths of eight people.

"The story that they entered the warehouse to execute the civilians is a real lie that is falling part," the lawyer for the soldiers, Juan Velazquez, told Radio Formula on Monday.

Velazquez said the testimony of three witnesses was full of contradictions and fabricated by civil organizations.

The attorney general's office said that it would provide more evidence to back the charges against the four soldiers during its appeal of their release.

The Tlatlaya case has put a spotlight on the controversial use of the armed forces to combat drug cartels in Mexico.

Troops have faced accusations of torture and abuse since then president Felipe Calderon deployed thousands of soldiers to combat gangs in December 2006.

In a separate case, four soldiers were detained in July in connection with the disappearance and murder of seven young people in the northern state of Zacatecas.

Source: AFP