(CNN)About an hour and a half before Odin Lloyd was shot to death, the suspect in his killing, Aaron Hernandez, was captured on video dancing at a gas station south of Boston. The former New England Patriots player has pleaded not guilty in the death of Lloyd, 27. The victim was dating the sister of Hernandez's fiancee. In security surveillance video shown in court Thursday, Hernandez pulls up at a gas station just after 2 a.m. on June 17, 2013. He gets out, and so does Carlos Ortiz, who has also pleaded not guilty in the killing and is being tried separately. Prosecutors say Ernest Wallace, who is charged with being an accessory after the fact, was also in the car.
@highlight
On that fateful night, Aaron Hernandez also had dinner with friends at a bar in Rhode Island
@highlight
The former New England Patriots player has pleaded not guilty to the killing
Carlos Ortiz
In the video surveillance, @placeholder and Hernandez appear off balance.
Aaron Hernandez
Hernandez
Hernandez
Aaron Hernandez
In the video surveillance, Ortiz and @placeholder appear off balance.
Aaron Hernandez
Hernandez
Hernandez
Aaron Hernandez
At one point, the @placeholder fumbles with the pump's hose, then moves in front of his headlights, swaying and moving his arms over his head.
Carlos Ortiz
Hernandez walks into the gas station, buys some gum and cigars from a clerk, then he and @placeholder leave at 2:12 a.m.
Carlos Ortiz
Investigators have said he then drove home and left with @placeholder and Wallace, before eventually picking up Lloyd.
Odin Lloyd
Lloyd
The judge has said @placeholder's sister is allowed to say she received four texts from her brother minutes before he was killed, but she won't be allowed to discuss what they said.
Odin Lloyd
Lloyd
In pretrial hearings, prosecutors have said @placeholder's final text read "nfl ... just so u know."