It all started with a few glasses of wine and two media titans talking about how hard life is.

Rupert Murdoch, the 87-year-old founder and co-executive chairman of 21st Century Fox and News Corp., and Bob Iger, the 67-year-old chief executive of the Walt Disney Co., met last August at Murdoch's Moraga vineyard in the Bel-Air hills of Los Angeles and discussed the myriad challenges their multibillion-dollar corporations faced, according to two people familiar with the discussion.

Facebook, Amazon, Netflix and Google were dwarfing their old-media conglomerates. As much as Murdoch liked positioning himself as the underdog and outsider, these new digital competitors were turning out to be too much.

Not long after Iger drove away from that conversation (and after other meetings Murdoch and his sons held with Verizon and Comcast), the two men sketched out a deal that involves Murdoch's selling the bulk of the company to Disney, but retaining a large stake in the combined entity. The proposed $70 billion agreement requires Iger to remain as CEO.

Aside from the big payday, it is a seminal moment for Murdoch, who is turning over the power to run the company he has spent his career building. The media mogul is saying goodbye to his life's work.

Murdoch's decision to sell part of his empire is the end of an era. It could be viewed as a surrender, a sign that he's given up trying to match the might of digital companies that are able to pay top dollar to churn out television series, movies, and comedy specials like candy. But it might turn out to be Rupert Murdoch's most deft move yet, the one where he saves his company, and fortifies his family fortune.

"Rupert is in the best of all possible worlds here," media and telecom billionaire John Malone, a longtime rival and confidant of Murdoch's, said in an interview.

The value of 21st Century Fox has risen by roughly $40 billion, to $91 billion, since CNBC first broke the story of Disney's interest. To those who know Murdoch, the sale represents a point of personal evolution — a shift from building voraciously to cementing his legacy.

Murdoch created one of the world's most powerful and influential media conglomerates out of two modest Australian newspapers he inherited from his father. But that company, under his leadership, also has survived a series of near disasters: the threat of bankruptcy in 1990; criminal investigations into its British papers hacking into people's voicemails; possible misuse of company funds to cover up sexual harassment allegations at Fox News; and antsy investors who worried that Murdoch was concerned more with empire-building than with their immediate financial gain.

More recently, his sons, James and Lachlan, who are the CEO and co-executive chairman of the 21st Century Fox, respectively, disagreed over the pace and manner of change required to survive in a digital era. And, increasingly, Murdoch came to grips with a future where the media behemoth he created just wasn't big enough to compete.

The decision to sell also comes as Murdoch has flexed other muscles. With President Trump's election, he's at the height of his political influence in the United States, a position he has long sought.

Murdoch has a direct line to Trump and close relationships with several Fox News personalities who act as unofficial advisers to the White House.

Trump and Murdoch talk weekly and sometimes daily, according to people close to both men. The morning Disney announced the agreement with Fox, Trump, who had sought assurances from Murdoch that he wasn't going to sell Fox News, called Murdoch to congratulate him on the deal. That approach contrasts with the public opposition Trump voiced to the AT&T purchase of Time Warner, which owns CNN.

In addition, former Fox News executive and Sean Hannity confidant Bill Shine is expected to take the job of White House deputy chief of staff in charge of communications, a role that only adds to the personal connections between Trump and the Murdoch-controlled news network.

Under the terms of the proposed deals Murdoch is entertaining, he will hold onto Fox News and Fox Sports 1, the Fox broadcast network, and its television stations. The smaller company will allow him to focus on the parts of the business that he is passionate about and that he sees as unique. Friends and associates describe that decision as well thought out on Murdoch's part.

"With Rupert there is a constant, restless mulling and introspection," said Robert Thomson, CEO of News Corp., the Murdoch-controlled company that consists largely of newspapers and real estate websites, including the Wall Street Journal, the Times of London, and the New York Post. "That endless reflection means that he has an understanding of the context of the moment." Thomson added that Murdoch is as vigorous in his pursuit of new projects as he has ever been.

Earlier in his life, Murdoch would have resisted the sale of his company, said Chase Carey, who worked for him for decades, was the former chief operating officer of 21st Century Fox, and remains a board member. "But life is never what you would have envisioned. People change and the world changes."

He added that Murdoch's strength is "to look both at where the world is today and what is the right path for the future. … That would have been a different set of answers 10 years ago. … You can't wish away Google and Amazon, but you can respond to the market realities of the moment."

To compete with the big digital players, a media company either needs massive scale or unique and defendable properties, Carey said.

Murdoch attempted scale when the company tried to acquire Time Warner a few years ago, but was rebuffed. Then, larger players such as Netflix started poaching major creative talent — for example, Ryan Murphy, who had been at Fox's FX, in a reported $300 million deal.

It was then that Murdoch began to realize that Fox could no longer compete without changing drastically.

In late June, Murdoch and his sons had a celebratory dinner with Disney's Iger at the River Café in West London, overlooking the Thames. Iger had agreed to substantially increase Disney's offer. Investors and executives expect that Comcast might yet make another, better offer to Murdoch, which could force Disney's hand yet again. But that possibility seemed less likely after the Justice Department announced its approval of the Disney transaction, with certain conditions.

Left over after a deal will be what is provisionally named "new Fox." That company will still have what Malone called the crown jewel of the company, Fox News. Lachlan and Rupert, who are both center-right politically, will oversee the news channel. James, who is center-left politically, will no longer be associated with it.

Murdoch has always said he wanted one of his children to succeed him, and over the years, his three adult children from his second marriage have jockeyed for that position. Lachlan, the elder son, has always been something of an heir apparent, even though Elisabeth, who is three years older than Lachlan, is viewed as the child most like her father.

She publicly clashed with her father and her brother James over their handling of the phone-hacking crisis in London — cementing her distance from the family business. Though relationships have mended, neither James nor Elisabeth are expected to take a role at new Fox.

"Rupert has some smart kids," said Malone. The two men have spoken about once a week since the proposed deal with Disney was announced. "They may not always get along with each other, but they are smart kids."

Murdoch's daughter from his first marriage, Prudence, has never been involved in the family business. His two daughters with his third wife are still not of age.

Two years ago, he married his fourth wife, Jerry Hall, the former longtime companion to Mick Jagger. Her children live primarily in London, and Murdoch has been spending considerable time there recently.

His move into what is presumably the last stage of his career mirrors a shift in the industry where he has made his mark.

Carey says that the media industry is in its fourth great revolution of the past century. First came film in the 1920s, then broadcast television in the '50s, then cable TV in the '80s, and now the digital revolution, which has laid waste to the fortunes of many traditional media players. Murdoch — it seems — is intent on avoiding that fate.

About four months after that glass of wine with Iger, his vineyard narrowly avoided destruction in a California wildfire. With his latest move, Murdoch may have engineered the same kind of escape for his company.