Following the bombing of an American military installation in the Middle East (the film shows footage from the 1996 Khobar Towers bombing), the US government orchestrates the capture of the mastermind believed to be behind the attack, Sheikh Ahmed bin Talal. In New York City FBI Special Agent Anthony Hubbard (Washington) and his Lebanese-American partner Frank Haddad (Shalhoub) are told of a hijacked bus, fully loaded with passengers and containing an explosive device. The bomb turns out to be a paint bomb and the terrorists manage to escape. The FBI receives demands to release the sheikh.
Hubbard eventually comes into conflict with CIA agent Elise Kraft (Bening). Hubbard takes a terrorist suspect into custody and arrests Kraft. Afterwards another terrorist threat is made and an MTA bus is bombed. When the FBI captures a man named Samir Nazhde he admits to signing the visa application of one of the suicide bombers in the course of signing many applications for student visas in his job as a lecturer. However, Kraft insists that Samir is not a terrorist and that his continued freedom is vital to the investigation.
The terrorist incidents begin to escalate. A crowded theater is bombed and later the FBI's New York City field office is destroyed with over 600 casualties.
In spite of objections, the President of the United States declares martial law and the U.S. Army's 101st Airborne Division, under Major General William Devereaux (Willis), occupies and seals off Brooklyn in an effort to find the remaining terrorist cells. Subsequently all young males of Arab descent, including Haddad's son Frank, Jr., are rounded up and detained in Yankee Stadium. Haddad resigns in anger. New Yorkers stage violent demonstrations against the army and the racial profiling of the Arabs and the Army fights to maintain control. There are reports of Army killings.
Hubbard and Kraft, now revealed to be an agent named Sharon Bridger, continue their investigation and capture a suspect, Tariq Husseini. Using torture, Devereaux shoots and kills Husseini (off screen) in the course of the interrogation. Afterward, Bridger tells Hubbard that Husseini knew nothing of value because of the principle of compartmentalized information and, sickened, she finally tells Hubbard what she knows. It is revealed that she herself provided training and support to militants opposed to Saddam Hussein's regime, working with Samir to recruit and train the followers of the Sheikh. After the US cut their funding and left them exposed, she took pity on the few of them who had not yet been slaughtered by Hussein's forces, and arranged for them to escape to the United States, ultimately leading to the present situation as they turn their covert and bomb making skills on the country that now holds their Sheikh. She and Hubbard compel Samir to arrange a meeting with the final terrorist cell. Hubbard convinces Haddad that he needs his help, and Haddad returns to the FBI.
A multi-ethnic peace march demonstrates against the occupation of Brooklyn. As the march is getting under way Hubbard and Haddad arrive at the meeting place, but Bridger and Samir have already left. Samir reveals to Bridger that he constitutes the final cell while in another sense he says, "there will never be a last cell." He straps a bomb to his body which he intends to detonate among the marchers. Hubbard and Haddad arrive in time to stop him from leaving, but Samir shoots Bridger in the stomach as she struggles to stop him. Hubbard kills Samir, but despite their best efforts he and Haddad can only watch as Bridger succumbs to her wounds after managing to recite certain lines of the second half of The Lord's Prayer and concluding with "Insha'Allah" – the Arabic phrase "God Willing."
Hubbard, Haddad, and other FBI agents raid Devereaux's headquarters to arrest him for the torture and murder of Husseini. Deveraux insists that under the War Powers Resolution the authority vested in him by the president supersedes that of the court which issued the arrest warrant. He then commands his soldiers to aim their guns at the agents, resulting in a tense standoff. Hubbard reminds Devereaux that the civil liberties and human rights which he took from Husseini are what all his predecessors have fought and died for. Devereaux finally submits and is arrested. Martial law ends, and the detainees, including Haddad's son, are freed.