Viacom has agreed to pay the legal bills of Philippe Dauman, Viacom’s chairman, president and chief executive officer, and George Abrams, a member of Viacom’s board of directors, relating to their removal as trustees of the Sumner M. Redstone National Amusements Trust, as directors of National Amusements, and as managers of certain subsidiaries of National Amusements.

Dauman and Abrams filed a lawsuit in the Probate and Family Court in Norfolk County, Massachusetts, on May 23 seeking to challenge their ousting, while on the same day attorneys for Redstone, chairman emeritus of Viacom, filed a petition in the Superior Court of California, Los Angeles County, seeking the court’s confirmation of the validity of their removal.

Under the deal, Dauman and Abrams are each required to repay the legal costs if it is determined by the court that either one “acted in breach of his fiduciary or other duties to Viacom or that he has not acted in good faith and in a manner reasonably believed to be in, or not opposed to, the best interest of Viacom,” or if they succeed in recovering the costs of the lawsuits from the trust and National Amusements.