After a years-long slog, wireless telecom T-Mobile (TMUS 0.02%) is one big step closer to being allowed to merge with rival Sprint (S) to form a service provider that can better compete with industry giants AT&T and Verizon. U.S. District Court Judge Victor Marrero on Tuesday ruled against a group of state attorneys general, who argued that the deal would reduce competition and potentially increase prices for consumers.

Graphic of rising arrow being pushed together by two businessmen.

Image Source: Getty Images.

The proposed merger has been in play since 2014, but has been stymied multiple times for reasons including regulatory roadblocks and disagreements about what the combined company would look like. 

Those efforts ultimately proved fruitful, however. The Department of Justice approved the pairing, with certain conditions, in July of last year. The FCC gave the two companies its green light in November, but also imposed conditions that dovetailed with the DOJ's stipulations. Namely, the two agencies have mandated that Sprint's Boost Mobile service and other prepaid service businesses be sold to satellite TV company Dish Network (DISH) and that Dish must be allowed to access enough of T-Mobile's network that it has a viable chance of becoming a major wireless provider in its own right.

The court case was the last of the major legal hurdles the two companies needed to clear, although minor ones remain. The California Public Utilities Commission must also approve the deal before any merger can be finalized, and another federal judge must approve Dish's new role using Sprint's and T-Mobile's assets. Neither of those are viewed as likely impediments.

The deal values Sprint at around $26.5 billion, to be paid entirely with T-Mobile stock.