UPDATED: T-Mobile’s $26.5 billion deal to merge with Sprint appears to have gotten the final green light, after a federal judge shot down a lawsuit from several U.S. state attorneys general that sought to block the combo.

The union of T-Mobile and Sprint will create a wireless carrier with more than 100 million customers, and the companies have claimed the “New T-Mobile” will provide stronger competition — especially on 5G — to bigger rivals AT&T and Verizon. Consumer advocates and the AGs that sued to block the deal argue that it will reduce choice and lead to higher consumer prices. T-Mobile execs have promised to not raise prices for three years following the merger.

The FCC and the Justice Department had previously approved the tie-up, under which Sprint is selling certain assets to Dish Network. Sprint shares shot up more than 70% Tuesday on the court’s ruling, and T-Mobile’s stock price climbed about 10%. Shares of Dish were up 5.8% in morning trading.

In a ruling Tuesday, Judge Victor Marrero of the U.S. District Court for the Southern District of New York rejected the lawsuit from AGs for 13 states and the District of Columbia to block the T-Mobile-Sprint merger. “T-Mobile has redefined itself over the past decade as a maverick that has spurred the two largest players in its industry to make numerous pro-consumer changes,” the judge wrote in the decision. “The proposed merger would allow the merged company to continue T-Mobile’s undeniably successful business strategy for the foreseeable future.”

John Legere, T-Mobile’s soon-to-depart CEO who led the Sprint deal, cheered the ruling. “Today was a huge victory for this merger … and now we are FINALLY able to focus on the last steps to get this merger done!” he said in a statement. Legere is set to step down in May, to be replaced as CEO by Mike Sievert (currently president and COO of T-Mobile).

The T-Mobile-Sprint merger will “result in a more competitive wireless industry” and is a negative development for Verizon and AT&T, UBS analyst John Hodulik wrote in a research note.

The proposed T-Mobile-Sprint merger is still subject to certain closing conditions, including “possible additional court proceedings,” the companies said. The attorneys general who sued to block the merger may still appeal. New York Attorney General Letitia James, who led the states’ challenge to the deal, said the AGs are reviewing their options, “including a possible 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 in a statement Tuesday. “There is no doubt that reducing the mobile market from four to three will be bad for consumers, bad for workers, and bad for innovation, which is why the states stepped up and led this lawsuit.”

After the merger, T-Mobile has committed to deploy 5G to 97% of the U.S. population within three years and 99% of Americans within six years. That includes commitments that its 5G network will reach 85% of rural Americans within three years and 90% within six years.  In lobbying for the deal, T-Mobile and Sprint have claimed in in the first year the combined entity will have more than 3,500 additional full-time U.S. employees than the standalone companies would have had and 11,000 more workers by 2024.

FCC Chairman Ajit Pai applauded the court’s decision, claiming the merger will “help close the digital divide and secure United States leadership in 5G.”

“This transaction represents a unique opportunity to speed up the deployment of 5G throughout the United States, put critical mid-band spectrum to more productive use, and bring much faster mobile broadband to rural Americans,” Pai said in a statement. “This is a big win for American consumers.”

Under Dish’s $5 billion deal with T-Mobile and Sprint, the satellite TV operator will acquire Sprint’s prepaid wireless businesses including Boost Mobile along with spectrum in the 800-MHz band and will enter into a seven-year mobile virtual network operator agreement with the new T-Mobile. That was required as a condition of the DOJ’s approval of the T-Mobile-Sprint merger, on the theory that it will establish Dish as a fourth competitor in the U.S. wireless market. “Along with a stronger T-Mobile, we believe Dish could replace Sprint as a formidable fourth competitor with attractive wholesale rates… and spectrum position,” UBS’s Hodulik wrote.