Mexican government officials were allowed to make casting decisions and changes to the script of the upcoming James Bond movie, after giving the film's producers millions in financial incentives, according to a report based on emails leaked in the Sony hack.

The government reportedly offered the makers of the upcoming “Spectre,” directed by Sam Mendes, $14 million in exchange for four minutes of the film portraying the country in a positive light.

Emails released from the Sony hack, published by tax policy website Tax Analysis, show that the studio was concerned that the film's costs had spiraled, to a gross budget of $300 million, making it one of the most expensive movies ever made. Executives pressured the filmmakers to make changes to the script that would keep the Mexican money coming in.

“You have done a great job in getting us the Mexican incentive,” wrote Jonathan Glickman, president of MGM’s motion picture group, in an email to the film’s producers. “Let’s continue to pursue whatever avenues we have available to maximize this incentive.”

To allow the studio to gain the maximum financial incentives available from the Mexican government, the email said that the producers needed to cast a "known Mexican actress" for the role of Estrella, a woman whose hotel room Bond uses to begin his hunt for an assassin named Sciarra.

The villainous Sciarra, however, "cannot be Mexican," it added.

Last week, it was announced that Mexican actress Stephanie Sigman would play the role of Estrella.

In addition, emails revealed that Mexico asked that the character of a Mexican governor, who was the target of an assassination, be replaced with an international leader, and that Mexican police be replaced with "some special police force" instead.

A further $6 million was said to have been achieved by means such as replacing a cage fighting scene with footage of Mexico's popular Day of the Dead festivities, and highlighting Mexico City's "modern" skyline, the Telegraph reported.

The Tax Analysis report suggests that the freedoms granted to Mexico go far beyond what such deals would normally encompass. The studio allowed "Mexican authorities to make casting decisions, dictate characters' ethnicities, and even change the occupation of an unnamed character."

The Bond movies are notorious for heavy-handed product placement, particularly in recent years. In 2006's “Casino Royale,” for example, Bond and another character have a conversation about the brand of watch he favors, and the brand logo on his laptop is shown prominently on-screen several times.