The opening scene of the movie explains how oil drilling has transformed the Middle East and abroad in a timeline sequence. It portrays the conflicts that have risen since the late 1940's for the rightful ownership of the Oil Industry. This includes the United States's involvement in Iraq and al-Qaeda's growing network of terrorism. Eventually, it explains the 9/11 terrorism attacks and how 80% of the hijackers were Saudis. This raises serious questions on the relationship between Saudi and the United States. The plot begins with the current struggle of Saudi Arabia and the Kingdom's efforts to stand control of their country against terrorist extremists.
During a game of softball played by American citizens in their oil company's housing compound, terrorists set off a bomb, killing many Americans, as well as Saudi State Police. The terrorists impersonated Saudi State Police members and while one team hijacked a car and started shooting residents of the area, another runs out onto the baseball diamond, pretending to aid the Americans, but then reveals that he is a suicide bomber and blows himself up, along with everyone near him. Sergeant Haytham of the Saudi State Police, disables the stolen SSP vehicle and kills the occupants. The FBI's Legal Attache in Saudi Arabia, Special Agent Francis Manner, calls up his colleague Special Agent Ronald Fleury (Jamie Foxx) to tell him about the attack. Shortly after this a second bomb explodes in the compound killing more people, including Manner.
Back in the U.S., Fleury briefs his FBI team on the happenings in the Kingdom, and Special Agent Janet Mayes (Jennifer Garner), a forensic examiner, breaks down in tears upon hearing of Francis's death. Fleury whispers something into her ear which causes her to control her emotions. While the higher-ups deny them permission to visit, Fleury blackmails the Saudi ambassador into letting them use a Saudi plane to get into the country in order to conduct an investigation. Fleury and his team of Mayes, Leavitt (Jason Bateman), an intelligence analyst and Special Agent Grant Sykes (Chris Cooper), a bomb technician, go to Saudi Arabia, where they are met by Colonel Faris al-Ghazi (Ashraf Barhom), the commander of the Saudi State Police force tasked with policing the compound. The Americans come to find that al-Ghazi is not in charge of the investigation, whose duties have been relegated to General Al Abdulmalik (Mahmoud Said) of the Saudi Arabian National Guard, who does not give them permission to investigate, rather they are to observe the investigation.
When the FBI team is invited to Prince Ahmed bin Khaled's (Omar Berdouni) palace for a dinner, Mayes is excluded because of her gender, Fleury takes the opportunity to convince the Prince that Colonel al-Ghazi is a natural detective, and should be allowed to lead the investigation. With this new change in leadership, the Americans are allowed a hands on approach to the crime scene and discover that the second bomb was set off in an Ambulance, and the bombs used marbles as projectiles. This revelation leads them to discover that the brother of one of the terrorists had access to ambulances and State Police uniforms, and the Police raid the house, managing to kill a few heavily armed men. The Americans are then told that they have to go home, by their Embassy's Deputy Chief of Mission Damon Schmidt (Jeremy Piven). However Fleury and al-Ghazi both believed that the teenagers that they had just killed were just amateur fighters, and were not the real planners behind the attacks.
On their way to the airport, Fleury notices a youth watching their convoy from an overpass, and then sees that the last SUV of their convoy has stopped far behind them, he then notices a speeding car coming towards them and grabs the wheel from Sergeant Haytham (Ali Suliman) which allows them to partially evade the collision that occurs when the speeding car runs into the first SUV of their convoy, setting off a trunk full of bombs. Their SUV, the third one in their convoy, hits the first SUV killing the men inside. The fourth SUV finally drives up and the men inside pull out Leavitt, throw him into the back and drive away while a second car drives by to shoot the surviving Americans. Fleury manages to wound one attacker, and al-Ghazi commandeers a civilian vehicle to chase the fourth SUV and the other car into the dangerous Suweidi neighborhood of Riyadh. As they pull up, a gunman launches a rocket at them and a firefight starts. Inside the complex, Leavitt is tied up and gagged while his attackers prepare to tape a video of his beheading.
After having killed their attackers, al-Ghazi decides that three of them must enter and find Leavitt and two must stay behind and cover the entrance. While Sykes and Haytham watch the entrance, al-Ghazi, Fleury and Mayes enter the building, following a blood trail and manage to finish off many other gunmen inside. Mayes, separate from the other two, scares a little girl in an apartment, and she enters to find a family with little children, their mother and grandfather. She yells at them to stay put and goes across the hall to another apartment to find Leavitt and his attackers. She kills the remaining insurgents, and al-Ghazi and the team start to leave. However, Mayes feels unsettled about the little girl, and walks in to give the girl a lollipop. In return the girl gives her a marble, matching the ones pieced together earlier from the bomb scene. Fleury then realises that there is a trail of blood leading to the back of the apartment, and al-Ghazi sees the grandfather, suspects something and asks to help him up in order to inspect his hand. When the old man gives him his hand, al-Ghazi sees that the man is missing the fingers that are missing in the terrorist group's many videos and confirms his idea that the grandfather is the terrorist leader. Abu Hamza's teenage grandson walks out of the bedroom and manages to shoot al-Ghazi in the neck twice with a pistol before it jams, prompting Fleury to kill him. Abu Hamza then feebly pulls out an assault rifle and Haytham puts three shots in his chest. As Abu Hamza dies, his younger grandson hugs him and Abu Hamza whispers something into his ear to calm the child down. Al-Ghazi dies in Fleury's arms.
At Al-Ghazi's house, Fleury and Haytham meet his family. Fleury tells his son that al-Ghazi was his good friend, mirroring a similar scene earlier in the movie where he comforted Special Agent Manner's son. The Americans return home, and Leavitt has one final question for Fleury: what did he whisper to Mayes to calm her down? The scene cuts to Abu Hamza's daughter asking her son what his grandfather whispered to him as he was dying. Fleury recalls saying "We're gonna kill them all," while the grandson tells his mother, "Don't fear them, my child. We are going to kill them all...." implying that this is a never-ending, vicious cycle.