D.C. police simply followed the money to find a man they say fatally shot a 68-year-old gas station attendant in Northeast Washington on Nov. 3.

The trail of loose coins began inside a Valero station in Brentwood. It led out a back door, down an alley and to a parking lot of a fast-food restaurant 600 feet away. The line of coins stopped near a trash bin, where police said they found a red and black baseball cap.

That cap, police said in court documents, had DNA. And that DNA, the documents said, led police to arrest Demetrius Pierce, 32, and charge him with second-degree murder while armed. He is accused of shooting the station attendant, Nazir Ahmad of Laurel, Md., and leaving him in a backroom.

A D.C. Superior Court judge on Tuesday ordered Pierce detained until a preliminary hearing Dec. 12. His attorney with the Public Defender Service, Jeffrey D. Stein, did not return a call seeking comment.

Ahmad’s family did not want to talk to a reporter shortly after the killing; they could not be reached on Wednesday.

The robbery and shooting occurred shortly after 6 a.m. at the gas station in the 900 block of Brentwood Road NE, in an industrial area between New York and Rhode Island avenues.

Court documents say it appears the shooter waited until Ahmad unlocked the cash register and left his booth for a break in a backroom. Surveillance video then shows a man entering the food mart area of the station and going behind the counter and unplugging the cash register.

Carrying the register, he tried to escape, but police said the front door did not open. He headed back to the counter and confronted Ahmad as he returned from the backroom, the charging documents state. Police said Ahmad was shot twice during the confrontation.

The gunman then shot out the glass door and fled with money, spilling coins from bags as he ran to a nearby McDonald’s. Police said in the court documents that “detectives observed multiple loose coins all throughout the alley leading to the McDonald’s parking lot. This was determined to be the suspect’s flight path.”

A witness reported seeing a man get into a van near the back of the store. The driver of the van, when stopped later, told police he had given a stranger a ride.

Police said that near the McDonald’s trash bin, they found plastic bags with coins scattered about, along with the cap with lettering on the front that read “Uptown, DC Superior.”

Police said that they were able to get a DNA sample from the cap and that on Nov. 16, a match identified Pierce. Police also said that he matched a description from the video and from the van driver.