As thousands of terrified Peruvians ran from falling buildings during a deadly earthquake, nearly 700 inmates took advantage of a collapsed prison wall to run to freedom. Wednesday's 8.0-magnitude temblor that devastated Peru's southern coast caused chaos inside the Tambo de Mora Prison on the outskirts of Chincha, just 25 miles (40 kilometers) east of the epicenter, police Lt. Jorge Soto said Friday. Built on the sandy soil of Peru's coastal desert, the lockup sank during the powerful quake and was severely damaged by a phenomenon called liquefaction, in which the prolonged shaking transforms loose, water-saturated sediments into a liquid slurry. "Tsunami, tsunami!" the inmates shouted mistakenly as almost 2 feet (0.6 meters) of muddy water rushed into their cells, said Soto, who works at the prison. Ceiling lights came crashing down, prison doors swung open, and the wall surrounding the prison crumbled. Soto said prison police desperately fired their weapons into the air to try to stop the inmates from escaping. But then "people in nearby houses also started to come out and everyone got mixed up," he said. "That's when we stopped shooting." When the shaking finally stopped after an agonizing two minutes, 90 percent of the prison was severely damaged and parts had collapsed, the National Penitentiary Institute said in a statement. "They weren't all just going to die inside," said Mirta Espinosa, whose husband, Daniel Vallejo, is one of the inmates. "They left to save their lives and see their families." Vallejo, 58, who has four years left in his five-year sentence for tax fraud, was one of 60 escapees who turned themselves into authorities Thursday and was waiting to be transferred to another jail. "He didn't want to be a fugitive," Espinosa said outside the prison. Twenty others were captured by authorities, and 607 were still missing Friday. Journalists were not allowed inside the prison, but Soto said most of the cells were still flooded with muddy water. In the town of Chincha the quake leveled scores of adobe homes and, according to some reports, killed as many as 170 people.