T-Mobile’s mega-merger with Sprint can move forward, the Justice Department said Friday, paving the way for an unprecedented combination of America’s third- and fourth-largest wireless providers.

The DOJ’s blessing marks a critical breakthrough for T-Mobile and Sprint as they seek to join forces against Verizon and AT&T, which owns CNN. The smaller carriers argue they must merge in order to compete more effectively, especially as the industry moves toward next-generation 5G technology. But critics argue the tie-up will lead to higher prices and less innovation, and the merger may not close until a multi-state lawsuit to block the deal is resolved.

The DOJ’s settlement was joined by five states that are not part of the lawsuit.

For weeks, Sprint and T-Mobile have been negotiating an agreement with the DOJ to address concerns the merger may harm competition. The resulting settlement Friday requires the combined company to spin off customers and assets to create a fresh replacement for Sprint in the cutthroat wireless business.

Picking up the pieces will be satellite provider Dish Network. Under the deal with DOJ, Dish will pay $1.4 billion to take over Sprint’s prepaid wireless business, including Boost Mobile and Virgin Mobile, totaling about 9 million subscribers. Dish will also pay $3.6 billion to purchase a chunk of valuable wireless airwaves from Sprint. Those airwaves could help rural Americans gain access to mobile Internet, according to the Justice Department.

The settlement alsogives the new Dish-owned carrier the right to use T-Mobile’s network for seven years, a condition meant to create breathing room for the new provider.

“Our goal was to ensure that the DOJ’s concerns were addressed while enabling us to deliver on every aspect of the synergies we promised to unlock… and we did it,” T-Mobile CEO John Legere said in a statement after the announcement. “It may have taken longer than expected by some, but today’s results are a win-win for everyone involved.”

Dish’s new carrier will likely be tiny compared to its prospective rivals. Verizon currently leads with 118 million prepaid and postpaid customers, according to financial filings, followed by AT&T with 94 million. Following the sale of Boost, the new T-Mobile will have about 92 million phone subscribers. (By comparison, Sprint had about 42 million prepaid and postpaid users at the end of March.)

Dish said Friday it has promised regulators it will build out a new 5G wireless network “capable of serving 70 percent of the US population by June 2023.”

The merger is not yet final. It must still be cleared by the Federal Communications Commission. And while a majority of that commission has signaled support for the deal, 13 states and the District of Columbia have also sued to block it from taking effect within their respective borders.

The fate of the transaction had hung in the balance for months as Justice Department antitrust chief Makan Delrahim deliberated on whether to block it. Briefing reporters Friday, a Justice Department official said the proposed merger could have been anti-competitive but that the concessions by T-Mobile and Sprint had lessened the risks.

“Without the remedies, combined T-Mobile and Sprint would have reduced competition for wireless services,” the official said. The Justice official said the department had been prepared to sue to block the deal had the companies failed to reach an agreement on the conditions.

In a Justice Department release, Delrahim said, “With this merger and accompanying divestiture, we are expanding output significantly by ensuring that large amounts of currently unused or underused spectrum are made available to American consumers in the form of high quality 5G networks.”

T-Mobile has proven to be an aggressive competitor in the wireless industry — slashing rates, ending consumer annoyances such as long-term contracts and early termination fees, and reintroducing unlimited data plans. In many cases, those initiatives attracted customers and forced the larger providers to respond in kind.

Sprint had a role to play in reshaping the industry, too — deeply undercutting rivals on price and using big promotions to lure subscribers.

Opponents of the merger say some of that vibrancy could soon be lost from the wireless sector, and that Dish’s fourth competitor will hardly compare.

“A new mobile wireless entrant that starts with zero postpaid subscribers and that must rely on its much bigger rival, the new T-Mobile, just to operate is not a competitor. It’s a mobile Frankenstein,” said Gigi Sohn, a distinguished fellow at Georgetown University’s Institute for Technology Law and Policy.

Sohn served as an FCC adviser during the Obama administration, when the US government repeatedly indicated that the country is better off with at least four competing national wireless carriers. That unofficial policy drove the FCC and DOJ to oppose AT&T’s attempted purchase of T-Mobile in 2011. The agencies were similarly critical when Sprint unsuccessfully sought to acquire T-Mobile in 2015.

While Friday’s settlement preserves the existence of a four-carrier industry, today’s regulators have expressed openness to alternatives. For example, at DOJ, Delrahim has argued there is no “magical number” of competitors that guarantees a healthy wireless sector.

Meanwhile, a majority of the FCC, led by Chairman Ajit Pai, came out publicly in May to voice support for the T-Mobile and Sprint deal even before an agreement involving Dish had been reached.

In a statement at the time, Pai said his support for the merger rested on two key principles: US taking leadership in 5G technology and improving internet access in rural and underserved areas. The Sprint and T-Mobile merger would help fulfill those goals, he said.

“I believe that this transaction is in the public interest and intend to recommend to my colleagues that the FCC approve it,” Pai said in the statement, indicating he would soon move for the FCC to complete the merger review. (He has not yet done so, but after DOJ’s announcement on Friday, Pai said he would soon.)

Pai’s remarks in May took industry analysts by surprise. Normally DOJ and the FCC coordinate their merger announcements, market research firm New Street Research noted in an investor memo at the time. But in this case, it said, the FCC appeared to show its hand well before DOJ was ready. It is not clear why the FCC did so, but it could have been calculated to pressure Delrahim into approving the deal, New Street added.

California, New York, Wisconsin and a handful of other states have alleged the merger is anti-competitive because it could eventually allow T-Mobile, Verizon and AT&T to raise prices in lockstep. T-Mobile has promised not to raise prices for at least three years after the close of the deal, but the states have said those and other pledges are not enough to limit the potential harm to competition. The states, Sprint and T-Mobile have agreed to a trial date of Oct. 7 in federal court in New York.

“We’re reviewing the announced settlement, but our bottom line remains the same: protect consumers and competition,” a spokesperson for California Attorney General Xavier Becerra said in a statement Friday.

The states involved in the case are home to so many of T-Mobile and Sprint’s customers that the lawsuit poses a significant challenge to the carriers’ plans, said Gene Kimmelman, a former Justice Department antitrust official who led the advocacy group Public Knowledge, which opposes the deal, until earlier this month.

“If the states win the suit, I have to believe the deal falls apart,” he said. “The deal would be effectively dead.”