Olivia Thirlby has been cast in Amazon’s legal drama “Trial,” Variety has learned. She joins Billy Bob Thornton, who is set to star in the David E. Kelley series.

“Trial” follows Billy McBride (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 his 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.

Thirlby (“Juno,” “No Strings Attached”) will play Lucy Kittridge, a whip-smart, high-powered attorney who knows what she wants, which is money, sex and respect. Though she’s brilliant, she’s not as seasoned as she pretends to be, which gets her into trouble.

Kelley, who created “The Practice,” “Boston Legal” and “Ally McBeal,” co-wrote the “Trial” pilot with his “Practice” and “Boston Legal” producer Jonathan Shapiro. Both will serve as exec producers on the series.

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

Thirlby is repped by 3Arts Entertainment, CAA and Stewart Brookman at Hansen Jacobson.