The deal that’s viewed as critical to T-Mobile and Sprint getting the thumbs-up for their merger is apparently done. Bloomberg is reporting that satellite TV provider Dish has reached an agreement with the two carriers that will see it acquire “prepaid businesses” (meaning Boost Mobile) for $1.5 billion and spectrum assets for another $3.5 billion.

That will put Dish in a position to replace Sprint as the fourth “major” mobile carrier in the United States. Maintaining the status quo of four competitors — even if T-Mobile and Sprint are allowed to combine — has apparently been a priority for the Department of Justice antitrust chief Makan Delrahim. Reaching this three-way pact with Dish is apparently enough to assuage his concerns: both CNBC and The Wall Street Journal are reporting that the US government will almost certainly sign off on the colossal $26.5 billion merger.

As part of the deal, Dish “gets a seven-year wholesale agreement allowing it to sell T-Mobile wireless service under the Dish brands,” Bloomberg reported. In simpler terms, that will give Dish wide and clear access to T-Mobile’s network as it tackles the time-consuming process of solidifying its own infrastructure. T-Mobile is also on the hook for three years of operational support as prepaid customers make the transition to becoming Dish customers.

The deal prevents Google or Comcast from just swallowing everything Dish will get

But there’s also a key aspect of the deal that was a sticking point for T-Mobile parent company Deutsche Telekom: Dish cannot sell its wireless business (or the newly acquired assets) to a third party for at least three years. That effectively prohibits a Google or a Comcast or an Amazon from quickly swallowing up everything that Dish is getting out of this deal and building out an even more formidable foe. (Deutsche Telekom would maintain majority control of the merged T-Mobile and Sprint if the deal is approved.)

And there’s the issue: T-Mobile and Sprint are telling the Justice Department that they want to maintain a healthy and competitive mobile landscape in the US, but the terms of this arrangement make it pretty clear that they are concerned about helping a new player too much.

Dish has been hoarding spectrum, but isn’t (yet) putting it all to use

Dish has not yet publicly commented on its negotiations with T-Mobile, Sprint, and the DOJ, but FCC filings have confirmed that CEO Charlie Ergen has had talks with the Justice Department’s antitrust unit and FCC chairman Ajit Pai. Though its business is satellite TV, the company has long possessed a large amount of wireless spectrum that it has done very little with: the treasure trove could be worth over $30 billion. This has led some to criticize Dish as a bad player in the industry for hoarding spectrum without any clear plan or purpose. It’s gotten to the point where Dish now faces fast-approaching deadlines to start putting that spectrum to use if it doesn’t want to risk losing the licenses.

The deal with T-Mobile and Sprint gives Dish exactly the opportunity it’s been waiting for. With its pay TV business in decline — Dish lost 256,000 customers in the first quarter amid an ongoing carriage dispute with HBO — this will set the company on a whole different trajectory.

If it all pans out as reported, Dish will emerge as a big winner from these hectic, drawn-out merger negotiations. If this deal hadn't been reached, it’s very possible the Justice Department would have sued — as state attorneys general already have — to block T-Mobile and Sprint from coming together. But even with it in place, there are no guarantees that Dish will be able to credibly compete over the long term with them once they do.