Sony Pictures and MGM have finally announced the worst kept secret in Hollywood. They’ve reached an agreement that will return Sony Pictures to its role as distributor of the James Bond movies. Sony, along with studios like Warner Bros, Paramount and Fox, all engaged in talks with the reconstituted MGM on a deal that came at a hefty price. Deadline reported previously that MGM walked away with the right to be co-financier on several plum Sony films, including the David Fincher-directed The Girl With The Dragon Tattoo, as well as others to be added to the mix, including the remake of Total Recall. The latter film might be particularly painful for Sony because sources tell us that MGM gets to distribute Total Recall in the highly valuable international TV market. This is considered a huge benefit to MGM in that it enhances the value of its international TV portfolio and robs Sony’s existing international TV partners of a title that is expected to be big overseas. Neither Sony nor MGM would comment on the horse-trading part of the deal.

Clearly, Sony wanted the Bond franchise back badly, and now Amy Pascal and Michael Lynton have brought 007 back into the fold. Deadline reported last summer that MGM was being reconstituted as a pure production play and shedding its distribution operation. That immediately put the studio’s most valuable title, 007, in play. Bidders began mobilizing before MGM made it out of bankruptcy. By January, several of the studios vying for Bond rights became increasingly frustrated by the attempts by MGM’s  new chiefs Gary Barber and Roger Birnbaum to leverage 007 distribution rights to get co-financing rights to plum projects at whatever studio won the deal. This came even after MGM had offered the villain role to Oscar-winner Javier Bardem, a courtship that is still going on (Anthony Hopkins has also been rumored as a potential participant on the evil side of the Bond dossier). Sony Pictures eventually got the upper hand and moved close to a deal in early February, after Sony threw co-fi rights to Dragon Tattoo and other titles into the pot. The announcement doesn’t deal with other MGM titles, but there are expected to be more that get distributed by Sony Pictures, which separately partnered with the studio on the Kevin James-starrer The Zookeeper. That film moved over to Sony when MGM went into deep freeze because of its crushing debt burden, and Sony moved it to the heart of the summer, with a July 8 release date. While Sony was winning that deal, rival suitors like Paramount (which has a strong relationship with Barber and Birnbaum over Star Trek) bristled at MGM’s asking price, plus a relatively low 8% distribution fee on the 007 film that Sam Mendes will direct and which Sony will release November 9, 2012, with Daniel Craig reprising. Here is the official announcement:

LOS ANGELES, CA., April 13, 2011 – Sony Pictures Entertainment will remain in the James Bond business after reaching an agreement with MGM to co-finance and theatrically market and distribute Bond 23 worldwide, it was announced today by MGM Co-Chairmen and Chief Executive Officers Gary Barber and Roger Birnbaum and Sony Pictures Chairman and CEO Michael Lynton and Co-Chairman Amy Pascal. Sony will release the next film in this iconic franchise on November 9, 2012 throughout the world except for select International territories, where MGM will directly oversee distribution.

Sony Pictures and MGM look forward to Sony Pictures co-financing and distributing Bond 24 on a similar basis.

Additionally, MGM and Sony Pictures have agreed to explore co-financing opportunities on future motion pictures produced by each of the respective studios for the next five years.

The two studios have collaborated directly and indirectly in recent years on numerous films, including Casino Royale, Quantum of Solace, 21, Yours, Mine and Ours, The Pink Panther, and the forthcoming Kevin James comedy Zookeeper.

The announcement of the agreement to distribute Bond 23 adds another high-profile title to Sony’s 2012 slate, which also includes Men in Black 3 and The Amazing Spider-Man, as well as I Hate You, Dad, starring Adam Sandler, Here Comes the Boom, starring Kevin James, 21 Jump Street, Resident Evil 5 and Total Recall.

“Sony Pictures is the ideal studio partner for us as MGM re-enters the filmmaking business. We have longstanding relationships with Michael and Amy and look forward to what promises to be a prosperous future together,” said Barber and Birnbaum.

“In addition to working together on Bond, this deal expands our relationship with MGM as we explore co-financing opportunities on other high-profile projects,” Lynton said. “Gary and Roger are incredibly thoughtful and experienced leaders who are outstanding creative executives and respected moviemakers. While we are excited to be back in the Bond business, we also look forward to future collaborations and I am confident that this agreement will be long-term, lucrative, and beneficial to both studios.”

“After successfully working on the re-launch of the James Bond franchise with Casino Royale and Quantum of Solace, we could not be more proud or privileged to continue our association with Barbara Broccoli, Michael G. Wilson, Daniel Craig, and the talented teams at EON and MGM,” said Pascal.

When Sony released Casino Royale and Quantum of Solace, the films had record-high grosses for the Bond franchise, with Casino Royale taking in $599 million in worldwide ticket sales and Quantum of Solace generating $577 million.