The CIA and the Pentagon pulled out all the stops for the creators of "Zero Dark Thirty," staging interviews with officials and a Navy SEAL for an inside account of the hunt for Osama bin Laden.
Critics praised the movie's gritty and gripping feel but, with the film due for release in major European markets this week, controversy has erupted over claims that it justifies US agents' use of torture on detainees.
The access granted to director Kathryn Bigelow and screenwriter Mark Boal has turned the Oscar-nominated movie into the most detailed public account that exists of the May 2011 raid on a Pakistani compound to kill Bin Laden.
Nate Jones of the National Security Archives research institute dubbed it "the closest thing to the official story behind the pursuit of bin Laden."
Bigelow has been forced to release a statement denying widespread allegations that the film set out to justify or sanitize the "enhanced interrogation techniques" employed during the so-called 'war on terror'.
Although the assistance offered to the "Zero Dark Thirty" crew sparked accusations that the White House used the movie as a propaganda tool, cooperation between Hollywood and the Pentagon or CIA is nothing new.
The first film ever to win Best Picture at the Academy Awards, "Wings" in 1929, featured dogfight scenes with bi-planes thanks to help from the army.
It was the beginning of a relationship that has grown over decades.
The film industry covets access to hardware and expertise that only the armed forces can provide, while in return, defense officials want to burnish the military's image on the big screen.
The Pentagon's criteria for justifying cooperation on any film or television project is loosely defined, but until recently has never been seriously questioned by Congress.
"It just basically says: 'Is it something that might be of benefit for recruiting and retention? And/or is it something that might tell the American public more about the US military?" explained Philip Strub, who leads the Pentagon's liaison unit with the entertainment industry.
For the Pentagon, the decision whether to work on a film project all comes down to the script.
Characters in uniform need to reflect what officials consider to be an accurate picture of the practices and the ethos of the military.
If not, then the Defense Department refuses to grant permission to film at a base or to rent out US tanks or aircraft for a production.
To the Pentagon's critics, the arrangement amounts to stealthy propaganda, with the military using its leverage to effectively censor screenplays.
"They make prostitutes of us all because they want us to sell out to their point of view," director Oliver Stone told author David Robb in the book "Operation Hollywood," which blasts the Pentagon's role.
"Most films about the military are recruiting posters," the director said.
It is out of the question for the Pentagon to assist movies with a sadistic drill sergeant, like a memorable character in "Full Metal Jacket," or the reckless, rule-breaking soldier in "The Hurt Locker," officials said.
"I wouldn't claim pure innocence to the notion of trying to shape military portrayals so that they come a little closer to what we believe is the real military," Strub told AFP.
Hollywood heavyweight Jerry Bruckheimer, producer of "Black Hawk Down," "Top Gun" and "Pearl Harbor," said the horse-trading with the Pentagon is about finding a practical compromise.
"If we feel it's hurting the integrity of the film, then we won't do it. And if they think it's going to hurt their image, then they won't do it," he said in "Operation Hollywood."
"So there are certain ways to change things, to change wording that they'll feel comfortable with and you'll get what you want."
Sometimes attempts at compromise fail, and movie makers have to spend more cash tracking down old US-made military equipment in foreign countries.
Kevin Costner clashed with the Pentagon over the script of "Thirteen Days," a film recounting the Cuban missile crisis.
Defense officials objected to the portrayal of Air Force chief General Curtis LeMay as a bellicose hawk, a description shared by most historians. But the Pentagon wanted his character depicted in a more positive light.
As a result, the production had to be moved to the Philippines at great cost.
Ties between the Pentagon and Hollywood frayed in the aftermath of the unpopular Vietnam War, and most movies about that conflict received no assistance from the military, including Stone's "Platoon" and Francis Ford Coppola's "Apocalypse Now."
But the release of the gung-ho fighter pilot movie "Top Gun" in 1986 was a watershed, reflecting a shift in American attitudes and a resurgence of collaboration between the Pentagon and Hollywood.
Strub's office receives dozens of proposals every year, and fewer than half get the green light.
He and his small team spend much of their time reading through scripts, looking for scenes or characters that are unrealistic, inaccurate or inappropriate.
But he dismissed the idea that the Pentagon coerces movie makers into sanitizing screenplays.
"The whole idea that we can force these creative people to do our bidding is quite hilarious," he said. "There are people who won't come to us just because they don't want the perceived taint of having even talked to us."
Also on HuffPost:
Osama Bin Laden
Al-Qaeda's Saudi leader was killed in an American raid on May 1, 2011. (AP Photo, File)
Ayman al-Zawahri became <a href="http://www.foxnews.com/us/2012/04/29/5-most-wanted-al-qaida-leaders/" target="_hplink">al Qaeda's new leader</a> after the death of Osama bin Laden. He is believed to be hiding in Pakistan and regularly releases propaganda videos. (AP Photo/SITE Intel Group)
Abu Yahia Al Libi
Abu Yahia al Libi was al Qaeda's <a href="http://www.huffingtonpost.com/huff-wires/20120429/us-al-qaida-top-5/" target="_hplink">de facto no. 2</a> after the death of Bin Laden. He escaped a high-security U.S. prison in Bagram, Afghanistan, in 2005 and <a href="http://www.huffingtonpost.com/2012/06/05/abu-yahia-al-libi-drone-strike_n_1569772.html" target="_hplink">was killed</a> in a strike in Pakistan in June 2012. (AP)
Al Wahishi was once bin Laden's <a href="http://www.huffingtonpost.com/huff-wires/20120429/us-al-qaida-top-5/" target="_hplink">aide-de-camp</a> and now commands AQAP, al Qaeda in the Arabian Peninsula . (AFP/GettyImages)
Ibrahim Hassan Al Asiri
Saudi Ibrahim Hassan al Asiri is <a href="http://www.huffingtonpost.com/huff-wires/20120429/us-al-qaida-top-5/" target="_hplink">believed to be responsible </a>for building uilding the underwear bomb used to try to bring down a Detroit-bound jetliner on Christmas 2009, as well as the printer-cartridge bombs.
Al Qaeda's number 3 was <a href="http://www.huffingtonpost.com/2010/05/31/al-qaeda-number-three-reported-killed_n_595561.html" target="_hplink">killed</a> in an American drone strike May 2012. (Reuters TV)
Fazul Abdullah Mohammed
Mohammed was <a href="http://www.huffingtonpost.com/2011/06/11/fazul-abdullah-mohammed-dead_n_875363.html" target="_hplink">killed</a> by the Somalian army in June 2011. He led the organization in Eastern Africa. (AP)
Abu Musab Al-Zarqawi
Al Qaeda's leader in Iraq was <a href="http://www.huffingtonpost.com/2010/04/19/two-top-al-qaeda-figures-_n_542653.html" target="_hplink">killed</a> in a U.S. airstrike in 2006. (AP Photo/U.S. Department of State, HO)
Khalid Sheikh Mohammed
Mohammed, the <a href="http://www.huffingtonpost.com/2012/05/06/khalid-sheikh-mohammed-trial_n_1489527.html" target="_hplink">self-described mastermind</a> of the attacks of 9/11, was captured in Pakistan in 2011 and is held at Guantanamo Bay. (AP Photo/FBI)
Saif Al Adel
Al Adel was Bin Laden's former <a href="http://www.huffingtonpost.com/huff-wires/20120229/ml-egypt-arrest/" target="_hplink">security advisor</a>. He is still on the run. (Getty Images)
Adnan El Shukrijumah
El Shukrijumah is responsible for Al Qaeda's external operations. He <a href="http://www.huffingtonpost.com/2010/08/06/adnan-shukrijumah-new-al_n_673164.html" target="_hplink">lived in the U.S.</a> for more than 15 years. (FBI)
Atiyah Abd al-Rahman
Al-Rahman was Al Qaeda's liaison for Iraq, Iran and Algeria until he <a href="http://www.huffingtonpost.com/2011/08/27/atiyah-abd-al-rahman-al-qaeda-dead_n_939009.html" target="_hplink">was killed</a> on August 22, 2011 in Pakistan. (AP Photo/National Counterterrorism Center)