AT&T Inc. has agreed to sell its Vrio Corp. video business in Latin America to Grupo Werthein for $500 million and will take a $4.56 billion writeoff in connection with the deal, capping a long effort to unload the business.

AT&T will receive payment over several years, the Dallas-based company said. Vrio offers service in 11 countries in Latin America and the Caribbean, with 10.3 million subscribers, the company said in a filing. It operates under the DirecTV and Sky brands.

AT&T had struggled for years to spin off or find interested buyers for the declining Latin American satellite-TV division, which has been a challenge ever since it was acquired with the rest of DirecTV in 2015.

Within months of closing that deal, AT&T wrote down $1.1 billion of its Venezuelan DirecTV business due to the political instability in the country.

In 2018, AT&T abandoned plans to sell a portion of Vrio via an initial public offering, even after reducing the number of shares and cutting the target price. And in May 2020, AT&T closed the business in Venezuela and followed with a $2.2 billion goodwill impairment a month later.

The latest writeoff includes $2.1 billion related to currency translation. AT&T is scheduled to report quarterly financial results on Thursday before financial markets open.

Werthein is a family-held Latin American conglomerate that’s more than 100 years old, with interests ranging from agribusiness to technology, including Telecom Argentina SA.

AT&T is jettisoning its U.S. video and entertainment businesses to focus on its wireless and internet services. The company plans to spin off its WarnerMedia film and TV operations into a new company with Discovery Inc. and is transferring its DirecTV division into a joint venture with TPG.

AT&T is said to be in talks to sell Xandr, its digital advertising unit, to the Indian company InMobi after giving up on ambitions to become a major player in online ads — an area dominated by Google and Facebook.

AT&T will retain its 41.3% interest in Sky Mexico.