BEIJING (AP) — Beijing prosecutors said Friday they had dropped criminal charges against five police officers over the death of a man who died in their custody, a 180-degree turn in a case that has sparked outrage in a country deeply suspicious of police abuse.

Six months earlier, the Beijing Municipal People's Procuratorate, which is responsible for both investigation and prosecution in China's legal system, had declared that police acted "improperly" during the detention of Lei Yang and arrested two officers on charges of negligence.

The announcement on social media of the reversal said investigators found that five officers had used excessive force and deliberately sought to cover up Lei's death, but the procuratorate concluded that their actions did not necessarily merit prosecution under Chinese law because they "admitted their crime and showed repentance."

The case comes three years after top Communist Party leaders began to declare that they would strengthen the rule of law in China, where top judicial officials openly acknowledge that wrongful convictions are rife and police brutality and torture often result in the shocking miscarriage of justice.

A 29-year-old environmentalist, Lei died in May after he was pinned by police following a physical struggle that began after he was questioned on suspicion of soliciting sex. His death sparked an outcry on social media and even in state-run outlets before prosecutors moved against the police officers, an unusual step in China.

Prosecutors said in June that an autopsy showed that Lei suffocated on his vomit while in a police vehicle rather than dying from a heart attack, as noted in the police report. Police also sought to block an initial investigation into Lei's death, prosecutors said.

Lei's friends and commentators also have questioned why the struggle was not filmed — the officers said all their video recording devices were broken — and why it took so long for medical help to arrive after Lei fell unconscious. Lei's family also said his head was covered with bruises.

After the charges were dropped, Chen Youxi, a prominent lawyer representing Lei's family, declined to comment.

The procuratorate's statement said officers used "excessive law enforcement actions" including holding down Lei's face with their feet, but it appeared to blame his death largely on his having eaten too much and choosing to resist arrest.

"The officers' improper conduct had a direct causal relationship with Lei's death, while Lei's full stomach at the time of his sustained resistance was closely related to his death," it said.

The agency also noted that the officers acted improperly not only by failing to promptly administer first aid to Lei but also by "deliberately fabricating facts, concealing the truth and hindering the investigation" in the aftermath, without giving details.

Yet charges were dropped because the officers "gradually confessed and repented," the agency said.

The agency also issued a separate question-and-answer document on Friday to point out that it has disclosed information and handled the case properly.

"Beijing procuratorial organs always adhere to open and transparent in order to win the public's trust," it said.