Billy Bob Thornton will star in David E. Kelley’s legal drama “The Trial,” Variety has learned, as the “Fargo” alum has closed his deal to lead Amazon’s series.

The project will mark the streaming service’s first-ever straight-to-series order, as the site usually allows audiences to view pilots and provide feedback on which should be picked up.

The series follows Billy McBride, played by Thornton, a once-respectable lawyer who was ousted from the high-profile firm he co-founded. Billy now spends his days getting drunk, with the occasional case tossed his way by his ex-wife, but Billy’s professional life is turned upside down when a young lawyer who has just been fired from his old firm brings him a wrongful death case that pits him against the head of his former firm.

Thornton’s role was previously offered to Kevin Costner, who passed on the part, after engaging in talks. The series would have been Costner’s first series regular role.

Kelley co-wrote the pilot with Jonathan Shapiro. Both will serve as exec producers on the series.

“The Trial” is the latest original series on Amazon’s growing slate, joining award-winning comedy “Transparent” and “Alpha House.”

Thornton is repped by WME and Media Talent Group.