Justin Timberlake cast in 'Bad Teacher'

Cameron Diaz also stars in Jake Kasdan comedy

Justin Timberlake has nabbed the coveted male lead in "Bad Teacher," the Cameron Diaz comedy that Jake Kasdan is directing for Columbia.

Molly Shannon and Eric Stonestreet ("Modern Family") also are joining the cast.

The script by Lee Eisenberg and Gene Stupnitsky follows a foul-mouthed, gold-digging seventh-grade teacher (Diaz) who, after being dumped by her boyfriend, sets her sights on a colleague (Lucy Punch) who is dating a substitute teacher (Timberlake) who also is the scion of a watch fortune.

Jason Segel has been cast in the supporting role of a gym teacher, and John Michael Higgins is slotted as the principal, but the studio had spent the better part of the new year looking though class photos trying to find its leading man.

John Krasinski, Joel McHale, Timothy Olyphant, Guy Pearce, Adam Scott and relative newcomer Cheyenne Jackson were in the mix for table reads and other tests.

Timberlake and Diaz dated for years before calling it quits in 2007.

Jimmy Miller is producing the feature, which starts filming this month in Los Angeles.

Timberlake, repped by WME and Rick Yorn and Jennifer Davisson Killoran, seems to be making a concerted push into larger movie roles. After spending time in supporting parts in such movies as "Alpha Dog" and "The Love Guru," the "Teacher" lead comes on the heels of him wrapping up a co-starring role in Columbia's "The Social Network."