Police were looking for Cesar Morales who allegedly fired a gun down an escalator at the Columbia Heights Metro stop in the District in August. He was arrested Thursday night in Montgomery County. (Courtesy of D.C. Police/Courtesy of D.C. Police)

A man who police said fired a gun into a District Metro station Aug. 25 had walked away from a federal prison-run halfway house three weeks earlier, but a clerical error meant no one in law enforcement had been looking for him, authorities said Friday.

Lamont Ruffin, the chief deputy for the U.S. Marshal's Office in the District, said the halfway house notified the Bureau of Prisons, who listed 22-year-old Cesar Morales as an escapee. Morales had been nearing the end of a five-year prison sentence for shooting a man in the District.

The bureau emailed Ruffin's office on Aug. 7, two days after authorities said Morales absconded. But he said "due to an administrative error," his office failed to enter the information into a law enforcement database that would have flagged Morales to any local, state or federal law enforcement agency in the country.

The error also meant that Ruffin's own marshals did not actively search for Morales, whose family lives in Columbia Heights. Ruffin said he ordered an internal review.

The mistake was brought to light after D.C. police Chief Peter Newsham identified Morales as a suspect in the Metro shooting and told reporters that no arrest warrant had been issued in connection with the escape. Morales was arrested Aug. 31 in Montgomery County. Ruffin said the agency does not immediately seek arrest warrants in such cases, but are supposed enter his name in the database people can be detained.

Morales had been moved from a prison to the halfway house to ease his transition back into society. In many cases, inmates at halfway houses are allowed out for work, and are required to return at certain hours. The prison bureau said Morales left Aug. 5 and did not return.

The Metro shooting occurred about noon on Aug. 25. Police said Morales chased a man and then shot at him as he ran down the escalator at the Columbia Heights Metro in the 1400 block of Irving Street NW. No one was injured.

Police said they chased a man with a gun a few minutes later on 16th Street, and saw him drop it. An officer found a shell casing on the station's stairs. Police have said the intended target disappeared and they don't know his identity.

A D.C. Superior Court judge on Friday ordered Morales detained until a preliminary hearing Monday. He is charged with assault with a dangerous weapon.