OAKLAND — The murder charge barely made it past its first legal test, with a judge expressing “real concerns” and finally agreeing to allow things to move forward by a “razor thin” margin.

Now it’s over. The defendant, Josiah Dempsey, 22, pleaded no contest to carrying a concealed firearm in person, and was sentenced to a three-year prison term that, with good behavior, he had already served behind bars. As part of the plea deal, Alameda County prosecutors dropped the murder charge against him.

Dempsey, an Oakland resident, had been charged with killing 25-year-old Devonya Thurston inside the Go Go Amigo Market on 105th Avenue on the afternoon of July 1, 2024. Surveillance footage from inside the store showed tension between Dempsey and Thurston, which Dempsey attempted to diffuse by shaking Thurston’s hand. Thurston rejected the offer, telling him, “it’s not cool,” according to witness testimony.

The footage shows Thurston leaving and coming back on camera, which Dempsey’s lawyer argued was when he grabbed a weapon. When Thurston blocked Dempsey’s exit from the store, Dempsey allegedly pulled an assault rifle from his pants and shot him six times.

Judge Clifford Blakely, who reviewed the evidence at a preliminary hearing last year, said he was upholding the murder charge by a “razor thin” margin and that he didn’t want to speculate whether a jury would acquit Dempsey. He said it “doesn’t take a genius” to surmise why Thurston walked away and returned, but added that Dempsey couldn’t have known for sure “what Thurston got.”

After that hearing, Dempsey remained in jail for months while his lawyer and prosecutors negotiated a resolution. He pleaded no contest to the gun charge last December and was formally sentenced at a Jan. 20 hearing, court records show. At the time of his sentencing, he had less than two months left to serve.