The ruling clears one of the final hurdles for the deal, which still can't close until the California Public Utilities Commission approves the transaction. Tuesday's ruling also culminates a yearslong courtship between Sprint and T-Mobile, which have made multiple attempts over the years to merge, only to abandon their plans fearing regulatory scrutiny.
Attorneys general from New York, California, Connecticut, Hawaii, Illinois, Maryland, Michigan, Minnesota, Oregon, Wisconsin, Massachusetts, Pennsylvania, Virginia and the District of Columbia originally brought the lawsuit to block the deal following approval from the Justice Department and the Federal Communications Commission. The states had argued that combining the No. 3 and No. 4 U.S. carriers would limit competition and result in higher prices for consumers. The companies had contended their merger would help them compete against top players AT&T and Verizon, and advance efforts to build a nationwide 5G network.
In his decision filed Tuesday, Judge Victor Marrero wrote, "The resulting stalemate leaves the Court lacking sufficiently impartial and objective ground on which to rely in basing a sound forecast of the likely competitive effects of a merger."
The judge laid out three points on which the court rejected the states' objections to the merger. First, he said, they failed to convince the court that the merged party "would pursue anticompetitive behavior that, soon after the merger, directly or indirectly, will yield higher prices or lower quality for wireless telecommunications services."
Second, the court rejected that Sprint would be able to continue operating effectively as a wireless services competitor without the merger.
"The Court is thus substantially persuaded that Sprint does not have a sustainable long-term competitive strategy and will in fact cease to be a truly national [mobile network operator]," the ruling said.
And finally, the court rejected the states' argument that Dish Network "would not enter the wireless services market as a viable competitor nor live up to its commitments to build a national wireless network." The deal called for Dish to step in as a new wireless player based on agreements with the DOJ and FCC. Shares of Dish were up 7.1% on the judge's ruling.
In a statement after the ruling, New York Attorney General Letitia James, who helped lead the states' push, said the states "disagree with this decision wholeheartedly, and will continue to fight the kind of consumer-harming megamergers our antitrust laws were designed to prevent." She called the ruling a "loss" for Americans who rely on wireless networks and said the states will review their options, including a potential appeal.
"From the start, this merger has been about massive corporate profits over all else, and despite the companies' false claims, this deal will endanger wireless subscribers where it hurts most: their wallets," James said.
California Attorney General Xavier Becerra, who also led the states' efforts, said in a statement: "Our fight to oppose this merger sends a strong message: even in the face of powerful opposition, we won't hesitate to stand up for consumers who deserve choice and fair prices. We'll stand on the side of competition over megamergers, every time. And our coalition is prepared to fight as long as necessary to protect innovation and competitive costs."
Makan Delrahim, who leads the DOJ Antitrust Division, said in a statement he was "grateful that the judge recognized the expertise of the Department of Justice and the Federal Communications Commission (FCC) in his evaluation of the transaction."
The case has seemed to escalate tensions between some of the state attorneys general and the DOJ, who are each pursuing investigations into Google. "As I have noted before, should a minority group of states, or even one, be able to undo the nationwide relief secured by the federal government, it would wreak havoc on parties' ability to merge, on the government's ability to settle cases, and cause real uncertainty in the market for procompetitive mergers and acquisitions," said Delrahim, who is recused from the DOJ's Google probe.
Top executives at T-Mobile and Sprint claimed a victory with the judge's ruling.
"[N]ow we are finally able to focus on the last steps to get this merger done!" T-Mobile CEO John Legere said in a statement.
T-Mobile and Sprint agreed to certain concessions to the government before the agencies cleared the deal. The companies told the FCC they would deploy a 5G network covering 97% of the U.S. population within three years of closing the deal. Sprint also agreed to sell Boost Mobile, Virgin Mobile and other prepaid phone businesses, as well as some of its wireless spectrum to Dish for $5 billion before gaining approval from the Justice Department.
FCC Chairman Ajit Pai said in a statement that he was "pleased" with the court's ruling and that the merger "will help close the digital divide and secure United States leadership in 5G," calling it "a big win for American consumers."
Dish co-founder and Chairman Charlie Ergen said in a statement that the ruling and approvals from the DOJ and FCC
"accelerates our ability to deploy the nation's first virtualized, standalone 5G network and bring 5G to America."
If approved by the California commission, the deal would create a new wireless competitor in Dish, which has tried for years to become a provider, spending billions on airwaves it has stored away. Under a previous deal between Dish and the DOJ and FCC, the company had a deadline this year to build a narrowband internet of things network connecting "people and sensors and microprocessors." If the deal clears, Dish will instead focus its efforts on building a 5G network covering 20% of the country by June 2022 and 70% of the U.S. population by June 2023, with the consequence of facing a $2.2 billion payment to the U.S. Treasury if it fails to live up to its commitments.
Legere, the T-Mobile CEO, announced last year that he would step down from the role and be succeeded by President and COO Mike Sievert. Legere had been expected to leave once the company's merger with Sprint was completed. Sprint and T-Mobile had initially said Legere would lead the combined company when they announced their intention to merge in April 2018.
— CNBC's Alex Sherman contributed to this report.