NEW YORK (Reuters) - Viacom Inc VIAB.O said on Saturday that Chief Executive Philippe Dauman will resign immediately, marking a victory for the family of controlling shareholder Sumner Redstone in the battle for the $40 billion media empire.

Philippe Dauman, president and CEO of Viacom, speaks at the Reuters Global Media Summit in New York in this file photo dated December 2, 2010. REUTERS/Brendan McDermid/File Photo

The settlement with Dauman also ends the legal fight between members of the Viacom board and Redstone's National Amusements Inc, the privately held company that holds 80 percent of the voting shares of Viacom and CBS Corp CBS.N.

Under terms of the settlement, Dauman, 62, will be replaced as chief executive by his longtime right-hand man, Viacom Chief Operating Officer Thomas Dooley, who will be interim CEO until Sept. 30, the end of Viacom’s fiscal year. Viacom said the board, working with Dooley, will make a decision on succession plans by then.

Dauman will stay on as non-executive chairman through Sept. 13 and be allowed to present his plan to sell a minority stake in Paramount Pictures to the Viacom board. Dauman will receive about $72 million under the agreement, according to sources familiar with the situation.

Sumner Redstone removed Dauman and Viacom board member George Abrams from the Sumner M. Redstone National Amusements Inc Trust in May. A spokesman for Redstone said the media mogul had been unhappy with the company’s performance and Dauman’s plans to sell a stake in Paramount Pictures.

Dauman and Abrams shot back with their own lawsuit to prevent their removal from the trust, arguing that Redstone was being manipulated by his daughter, Shari. Shari Redstone called the allegation “absurd” and said her father made his own decisions.

Redstone also moved to kick Dauman and four other directors off the board in June, sparking litigation in Delaware to block the attempt.

Under the settlement, the board would add the five directors that National Amusements put forward in June, bringing the board to 15 directors after Dauman departs, according to the announcement. Three of those directors are expected to step down after Viacom’s annual meeting next year, a source said previously.

Sumner Redstone’s granddaughter, Keryn Redstone, has filed a cross-complaint in connection to that lawsuit, and is planning to proceed with her lawsuit even if there is a settlement, according to a separate source familiar with the situation. However, that suit is unlikely to affect the removal of Dauman from Viacom and Redstone’s trust.

Since he became CEO in 2006, Dauman has received over $409 million in reported compensation, according to Equilar.

Dauman, who has worked with Sumner Redstone for more than 30 years, gained the title of executive chairman in February, when the media mogul relinquished that role. Shari Redstone had opposed Dauman’s elevation to executive chairman.

Shares of Viacom have fallen around 50 percent in the past two years as its cable networks, including MTV and Nickelodeon, suffered from falling ratings because younger viewers were migrating online and to mobile video. Viacom’s U.S. advertising revenue has declined for eight straight quarters.

Dauman has tried to turn Viacom around by wooing advertisers with data to better target commercials. Under his leadership, Viacom renewed a multi-year distribution contract with satellite TV provider Dish Network Corp DISH.O.

But it was Dauman’s plans to sell Viacom’s stake in Paramount Pictures, which investors cheered, that caused him troubles. Sumner Redstone, who won a long battle with media mogul Barry Diller to acquire the film studio in 1994, opposed the sale.

Despite Redstone’s opposition, Dauman had pushed on with the potential sale. As Reuters first reported, Chinese real estate and entertainment conglomerate Dalian Wanda Group has held talks with Viacom about acquiring the stake.

Shares of Viacom have risen more than 40 percent since Redstone removed Dauman from the trust on May 20, a move that some investors saw as the first step in a change in management that could eventually lead to a sale of the media company.