the kingdom is a 2007 american action thriller film directed by peter berg and starring jamie foxx chris cooper and jennifer garner the film is set in saudi arabia and is loosely based on the 1996 bombing of the khobar housing complex and the 2003 bombing of the riyadh compound.