BEIJING — In an unusual case of official action against the police, Beijing prosecutors said on Thursday that two officers had been arrested on charges of dereliction of duty that led to the death of a 29-year-old man in their custody.

The People’s Procuratorate of Beijing announced that an autopsy showed that the man, Lei Yang, had died of suffocation and that the police had acted improperly after detaining him on May 7.

The prosecutors also said that the police had blocked an investigation into his death after an outcry on social media. At the time, the police said Mr. Lei had a heart attack on the way to the police station, and that he had been taken to a hospital, where he was declared dead.