Lord emerges at 5:38 a.m., and the figure quickly turns back. The two go inside and do not leave again for another 12 to 13 minutes, a Suffolk prosecutor said Thursday in West Roxbury District Court, where Lord’s alleged killer, Edwin Alemany, was arraigned on several charges, including murder and kidnapping. Prosecutors did not say where the video was captured.

During those 12 minutes, law enforcement officials have told the Globe, Lord was beaten savagely in the vestibule of her South Boston apartment building, the start of an ordeal that would end 2½ hours later in Hyde Park’s Stony Brook Reservation, where she was stabbed repeatedly and strangled to death.

Snatches of those hours were caught on video from surveillance cameras mounted around Dorchester Street in South Boston, where Lord, a 24-year-old digital marketer, lived; the banks where her captor forced her to withdraw cash; and the roads to the Hyde Park reservation where she died.

Alemany, a 28-year-old father of a little girl who had been living in South Boston, kept his head down as Assistant Suffolk District Attorney John Pappas outlined the case against him.

Wendy Maeda/Globe Staff

Edwin Alemany was arraigned in the murder of Amy Lord at West Roxbury District Court on Thursday. His lawyer said he tried to commit suicide scratching open the arteries on his neck and arms.

On Wednesday, he had been arraigned in South Boston District Court
on charges that he assaulted two other women that same day: a young woman beaten on Old Colony Avenue about an hour before Lord’s kidnapping and another woman stabbed repeatedly on Gates Street just after midnight on July 24. Both women survived the attacks.

Hours after his arraignment in South Boston, Alemany, who was on suicide watch at the Nashua Street jail where he was being held, violently scratched his neck and arms, a failed effort to rip at his arteries and kill himself, his lawyer, Jeffrey Denner, said in court. A spokesman for Suffolk County Sheriff Steven W. Tompkins declined to comment on the incident.

An open gash was visible on the right side of Alemany’s neck, as a state forensic psychologist said Alemany told her he was still suicidal and hearing voices in the courtroom.

Denner has not said whether he will try to argue that Alemany was insane when he allegedly attacked the three women. But he said that his client has a long history of mental illness starting when he was 13 years old and began getting in trouble at school and, shortly after that, with the law.

“His family will tell you that he was a terrific kid who from an early age” had mental problems, Denner said. “When he was on his medication, he would do very well.”

On Thursday, Alemany’s parents and four young women, friends and relatives of Lord, looked on in court as Pappas described a criminal who later tried to cover up his violent acts:

After leaving Lord’s apartment, Alemany forced her into her black Jeep Cherokee and at 6:03 a.m. went to Mt. Washington Bank on Southampton Street, the first of five banks where Lord was forced to withdraw cash.

At least two surveillance videos show Lord, sitting in the front passenger seat with her face bruised, as she leaned across the driver’s seat to withdraw money.

At 7:05 a.m., surveillance cameras show the Jeep crossing River Street and turning on Gordon Avenue toward the reservation.

At 8 a.m., Alemany, still driving the car, stopped for gas at a Hess station on Washington Street, an employee of the station later told police. He was alone.

At 8:30, the Cherokee was found in Sterling Square, engulfed in flames. About an hour after that, a 911 call came into the South Boston police district station reporting Lord missing. Police were told she had not made it to the MBTA bus stop where she usually met a friend to go to a gym downtown and she had not arrived at work.

At 9:55 a.m., Alemany stopped at Rotary Variety, a bodega in South Boston
, where Alemany lived with his girlfriend. He spent $400 at the store, where he bought a cellphone and paid off his cellphone bills, prosecutors said. He later told people he knew that he had won the lottery, Pappas said.

Lord’s body was found by a passing bicyclist at 4:05 p.m. that day.

Alemany, who was ordered held on $3 million cash bail on the assault charges, was sent back to Bridgewater State Hospital Thursday after Denner argued that he needed to be supervised by people trained to deal with mental illness.