AT&T has finally thrown in the towel for the pursuit of T-Mobile USA.

The Dallas-based company announced Monday that after a thorough review of its options it was backing out of the $39 billion deal, thus avoiding a costly and potentially lengthy legal battle.

Plans to merge were announced in March. The companies said the deal would provide AT&T the opportunity to build out a stronger wireless network by using some of the spectrum available to T-Mobile, eventually leading to stronger service for customers.

The AT&T and T-Mobile USA combination would have offered an interim solution to this spectrum shortage. In the absence of such steps, customers will be harmed and needed investment will be stifled, Monday's statement from AT&T said.

However, many were concerned that the merger would stifle competition in the wireless market and create a duopoly between AT&T and Verizon Wireless. Sprint Nextel, the third largest wireless carrier, expressed almost immediate opposition to the deal. Sprint stock has jumped more than 5 percent in after-hours trading.

From the beginning, Sprint has stood with consumers who spoke loudly and clearly that AT&T's proposed takeover of T-Mobile would create an undeniable duopoly that would have resulted in higher prices, less innovation and fewer choices for the American consumer, Sprint said in a statement following the announcement of the merger breakup.

Sprint commends the Department of Justice, the Federal Communications Commission and the bi-partisan group of state attorneys general who gave voice to the concerns of consumers across the country, the statement continued.

In August, the U.S. Department of Justice filed a lawsuit to prevent the deal from going forward, saying the deal would lead to higher prices and less competition between wireless carriers. The trial was supposed to begin within the next few months.

Sprint and regional carrier C Spire Wireless also filed lawsuits in attempts to block the merger, and those cases were expected to begin following the case with the Justice Department.

The Federal Communications Commission also came out against the deal in November and called for an administrative hearing on the deal. The hearing would have placed the burden of proof on the merging companies that the deal was in the consumer's interest. The FCC is required to approve telecommunications mergers.

Despite the opposition, AT&T and T-Mobile continued to plead their case. AT&T specifically used the public's concern about jobs to promote the merger, saying the deal would create up to 100,000 new jobs as the wireless network was being rolled out.   

In a last ditch attempt to keep the merger alive, AT&T and T-Mobile discussed selling off assets to other wireless carriers in order to court favor with regulators. However, deals with companies such as San Diego-based Leap Wireless fell through over concerns that selling off assets wouldn't convince skeptical regulators to approve of the deal.

Wedbush Securities analyst Suhail Chandy told IBTimes he expected the deal would end following the FCC's decision to block the merger.

After that, I think the market priced the fact that the deal was going to fail, he said.

Independent telecommunications analyst Jeff Kagan, who opposed the merger, wasn't suprised by Monday's announcement either.

AT&T would have been the only one who would have benefited from the merger, he told IBTimes. The rest of the marketplace would have been harmed.

AT&T will have to pay Deutsche Telekom a $4 billion breakup fee, which includes $3 billion in cash and $1 billion in spectrum. AT&T announced in November that it was setting aside the money in the fourth quarter, leading to a lot of speculation that the merger would eventually be called off. For many years, telecommunications companies would receive approval for mergers without much of a fight, Kagan said. He believes this is why AT&T agreed to such a large breakup fee with Deutsche Telekom.

Although the merger has been called off, AT&T will still need to obtain spectrum in order to compete with its rival, Verizon Wireless. The stakes have been heightened after Verizon announced earlier this month that it agreed to purchase wireless spectrum from SpectrumCo for $3.6 billion. SpectrumCo is a joint venture between Comcast, Time Warner Cable and BrightHouse.

Then Verizon Wireless announced Friday it had entered into an agreement with Cox Communications where Verizon would purchase wireless spectrum from the cable company for $315 million. All spectrum deals must receive approval from the FCC.

Fortunately, AT&T should be receiving some spectrum from Qualcomm following FCC approval, Chandy said.

Deutsche Telekom has shown interest in spinning off its T-Mobile unit in some way. This could provide Sprint an opportunity to purchase T-Mobile, Kagan said, since a deal such as that would likely be approved by regulators.

Other options for T-Mobile include pursuing a joint venture with AT&T to share spectrum, which has been discussed according to media reports. Also, T-Mobile could use the $4 billion breakup fee from AT&T to enhance its own wireless network, although Deutsche Telekom may not agree to that if it is looking to spin off T-Mobile.

Both Chandy and Kagan point out telecommunications companies may not have the appetite to forge ahead with large mergers given the consolidation of the wireless market.

And I wouldn't expect to see more $4 billion breakup fees any time soon, Chandy said.

Shares of AT&T are down 0.56 percent to $28.58 in after-hours trading.

This story has been updated to provide analyst comment, further background information and stock quotes.