One way to do that was by casting actors who could break up the intensity with some improvised gallows humor. Foxx in particular embraced the challenge. ''I knew Pete would make it fun,'' says the actor, who was approached for the role by Mann, his Miami Vice director. ''He'd put enough light humor into it to make it really move as a movie, as opposed to a documentary or a here's-my-point-of-view movie.'' The repartee between Foxx's FBI spook and a Saudi colonel (Ashraf Barhoum) turned out to be a good source of culture-clash levity. Bateman also did his part to counter the bleakness of the subject matter — to a point. ''Pete wanted me to go above and beyond what was written on the page,'' says the actor, who plays the mission's most reluctant agent. ''I say something smart-ass every once in a while, but for the most part I'm there looking scared.''

Berg was committed to keeping the cast away from any real danger, so he decided early on not to shoot in Saudi Arabia (a country that doesn't even have movie theaters). Instead, the production split time between the Arizona desert and Abu Dhabi, the capital of the United Arab Emirates. Ironically, it was the U.S. portion of the shoot that turned out to be the most difficult. First, there was the Berg factor — he liked to keep his cast slightly off balance in the hopes of capturing more authentic reactions. He would often shout lines at the actors from behind the camera as they occurred to him. ''He's so crazy,'' says Garner, whom Berg playfully bullied and once even accidentally slugged in the stomach, full force, thinking her Kevlar vest would protect her. ''I was amused that they were going to give him money [to make the movie]. But he kept the story marching ahead. This was one of those times where it was the director's movie.''

Even more off-putting were the several weeks spent filming an elaborate car-chase sequence on an Arizona blacktop in 125-degree heat. ''I was driving once a week to the hospital to visit a crew or cast member who had shut down from heat exhaustion,'' says Berg. Twice that trip was to see Garner, who was breast-feeding her new baby between setups and who suffered two bouts of heatstroke. Bateman didn't handle it much better. ''I threw up,'' he says. ''I turned into a real sissy.''

Then things got really bad. A construction worker, Lance Gunnin, was killed in a motorcycle wreck on his way to work. Prop maker Tom Aguilar went to the hospital with stomach cramps, learned he had prostate cancer, and died a week later. Finally, there was the on-set collision between an SUV and a small crew vehicle in which 25-year-old prop master Nick Papac perished while the rest of the crew watched in horror. ''It was the most tragic experience I've gone through,'' says Berg, who was a passenger in the truck that hit Papac. ''It galvanized all of us to honor Nick with every creative fiber in our bodies.'' The Kingdom ends with a dedication to the men who died while making it.

Given the film's wrenching history, Berg is especially eager to avoid further problems, and he's praying The Kingdom won't fuel Rambo-esque xenophobia or anti-American protests around the world. But so far, those worries seem unfounded. Not long after that Sacramento screening, the director nervously unspooled the film for a heavily Islamic London audience. To Berg's surprise, they reacted exactly the same way the Americans did — with an eruption of applause when good triumphs over terror.

After the credits rolled, Berg asked a young woman in traditional dress why she was clapping so enthusiastically. ''She said, ' Kick-ass action!''' recalls the director, his eyes widening in amazement. ''At that moment I realized we have so many misconceptions. The movie wasn't being looked at in terms of religion. It was just people accepting it as a story about people trying to stop extreme violence. And that's a universal thing.'' Champagne, anyone?