WASHINGTON (CNN Money) – The U.S. Justice Department has agreed to a settlement with Disney that will allow it to purchase most of 21st Century Fox’s assets. As part of the settlement, Disney will have to sell off 22 of Fox’s regional sports networks.

Disney’s purchase is not final. The settlement must first be approved by a federal judge, and Fox’s shareholders also have to vote in favor of the deal.

READ MORE: Arlington Police Officer Shoots, Kills Suspect Who Allegedly 'Drove Directly Towards Officer'

Disney said in a statement that it is pleased to resolve the Justice Department’s “limited potential concerns.” The company had earlier said in proxy filings that it would sell the sports networks if required by the government.

Disney first reached an agreement last December to buy most of Fox’s TV and movie assets. The company sweetened its offer earlier this month after Comcast tried to gatecrash the deal. Comcast has not stated publicly if it will try to counter again. Comcast did not immediately respond to a request for comment Wednesday.

Last week, Fox said that it would still consider bids from other companies, even though it believed that Disney’s new offer was better than Comcast’s.

READ MORE: Small Plane Overturns At Dallas Executive Airport

21st Century Fox is the next big prize as the media industry consolidates to survive against competitors such as Netflix and Facebook.

If Disney closes the deal, it will get Fox’s movie studio along with cable channels like FX and National Geographic. Disney would also get Fox’s stake in the streaming service Hulu, along with its stake in the European broadcaster Sky.

The government approved the Disney deal with Fox about six months after the merger was announced, a relatively quick timeline for the large size of the transaction. Wednesday’s news comes about two weeks after the Justice Department lost its attempt in court to stop AT&T from buying Time Warner. Antitrust regulators challenged that deal because they said that it would harm competition and raise prices for consumers.

In Disney’s case, officials said that their concerns about the deal would be alleviated as long as Disney sold the regional sports networks. “American consumers have benefitted from head-to-head competition between Disney and Fox’s cable sports programming that ultimately has prevented cable television subscription prices from rising even higher,” said Assistant Attorney General Makan Delrahim of the Justice Department’s Antitrust Division. “Today’s settlement will ensure that sports programming competition is preserved in the local markets where Disney and Fox compete for cable and satellite distribution.”

MORE NEWS: Domestic Violence Incident Involving Gunfire Led To Dallas Apartment Gas Explosion, Court Documents Show

(© Copyright 2018 Cable News Network, Inc., a Time Warner Company. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)