NEW YORK -- Facing heavy resistance from the U.S. government to its $39 billion bid for T-Mobile, AT&T on Monday officially killed off the deal that would have created by far the nation's largest wireless company.

AT&T went down fighting. It warned that consumers will be worse off because of the Federal Communications Commission and the Department of Justice's successful moves to block the deal.

AT&T claimed that the deal was necessary because of a nationwide wireless spectrum crunch. As smartphones and tablet sales have soared, consumers' demand for data -- and the spectrum that carries it -- has grown exponentially.

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

Because spectrum is a scarce asset, the wireless industry is scrambling to consolidate, with larger companies buying up smaller companies with big spectrum allotments. Verizon earlier this month bid $3.6 billion for spectrum held by a consortium of cable companies, and Sprint agreed to throw its partner Clearwire a $1.6 billion lifeline.

AT&T's solution was much grander in scale. The nation's second-largest wireless provider would have purchased the fourth-largest, creating a megacompany with well over 120 million subscribers.

The FCC and DOJ both sought to block the deal, citing the likelihood of higher prices, worse service, less consumer choice and massive job cuts.

Realizing it would not gain the approvals it needed to buy T-Mobile, AT&T ended its bid -- but hinted that it will be forced to buy something else soon.

"Adding capacity to meet these needs will require policymakers to do two things," Stephenson said. "First, in the near term, they should allow the free markets to work so that additional spectrum is available to meet the immediate needs of the U.S. wireless industry. Second, policymakers should enact legislation to meet our nation's longer-term spectrum needs."

AT&T will pay T-Mobile's parent company Deutsche Telekom a $3 billion breakup fee over the scrapped deal. It will also allocate $1 billion worth of spectrum to the company before the year's end. AT&T also plans to enter into a roaming agreement T-Mobile, which will allow customers of both networks to make use of the other's network.