Following the end of the 1990–91 Gulf War, U.S. soldiers are sent over to clean up loose ends. The soldiers are bored over the lack of violence and as a result throw parties at night. Major Archie Gates (George Clooney), a U.S. Army Special Forces soldier, is trading sex for stories with a journalist, Cathy Daitch (Judy Greer) when he is interrupted by Adriana Cruz (Nora Dunn), the television reporter he is assigned to escort. While disarming and searching an Iraqi officer, U.S. Army Reserve Sergeant First Class Troy Barlow (Mark Wahlberg), his best friend Private First Class Conrad Vig (Spike Jonze), and their unit find a map between his buttocks. Troy goes to Staff Sergeant Chief Elgin (Ice Cube) to help translate the map. Major Gates appears, after tracking down a lead from Adriana. Archie convinces them that the document is a map of bunkers near Karbala, containing gold bullion stolen from Kuwait, which they decide to steal. To keep Adriana off his back, Gates sends Specialist Walter Wogeman (Jamie Kennedy) to aid her on a false lead.
They set off the next day and, among other goods plundered from Kuwait, find the gold, and stumble on the interrogation of Amir Abdullah (Cliff Curtis). As they are leaving, Amir's wife pleads with them not to abandon the anti-Saddam dissidents, but she is executed by the Iraqi Republican Guard. The group decides to free the Iraqi prisoners, triggering a firefight. They pull out just as Iraqi reinforcements arrive, and as they try to evade a CS gas attack, they blunder into a minefield and get separated. Iraqi soldiers capture Troy while a group of rebels rescue the other Americans and take them to their underground hideout. There, Conrad, Chief and Archie agree to help the rebels and their families reach the Iranian border, after they rescue Troy.
Troy gets taken back to the bunker, and is thrown in a room full of Kuwaiti cell phones. He manages to call his wife back home and tells her to report his location to his local Army Reserve unit. His call is cut short when he is dragged to an interrogation room where he is interrogated by Iraqi Captain Saïd (Saïd Taghmaoui).
The Americans with the rebels go to a band of Iraqi Army deserters, who are persuaded to sell them luxury cars stolen from Kuwait. The cars are outfitted as Saddam's entourage, in a ruse to scare away the bunker's defenders. After storming the bunker, they free Troy, who spares Saïd, and find more Shi'ite dissidents held in a dungeon. A few of the soldiers who ran away return, who shoot Conrad and Troy. Conrad dies, and Troy's lung is punctured, but he survives.
Archie radios Walter and Adriana and arranges transport, while the hapless officers in the camp try to locate the trio after getting the message from Troy's wife. Each of the rebels is given a bar of gold and the rest is buried as they wait for the transport to arrive. The convoy goes to the Iranian border, where the three Americans will escort the rebels across to protect them from the Iraqi soldiers guarding the crossing. But the American officers arrive and stop the group, arresting the trio while the rebels are recaptured. Archie proffers the buried gold to the American officers in exchange for letting the refugees through.
All of the soldiers are cleared of the charges, thanks to Adriana's reporting. Archie goes to work as a military adviser to Hollywood action films, Chief leaves his airport job to work with Archie, and Troy returns to his wife and baby, running his own carpet store. The stolen gold was returned to Kuwait; however, it is implied that some of the gold was missing.

Question: What war has just finished at the beginning of the story?
Answer: the Gulf War