Days before Thanksgiving, AT&T’s heavyweight lobbying team was busy setting up meetings with antitrust authorities scrutinizing the company’s $39 billion acquisition of T-Mobile.

Julius Genachowski, chairman of the Federal Communications Commission, was on the line for AT&T’s chief executive, Randall Stephenson, and its chief of lobbying, James Cicconi. In a few hours, Genachowski said, he would announce his opposition to the deal. AT&T was stunned.

In a city overrun with lobbyists and corporate interests, AT&T is king of the heap — the bare-knuckled brawler that spares no energy or expense to win any fight. Since 1998, the company has given more money in campaign contributions than any other firm in corporate America. It’s also one of the top 10 corporate spenders on lobbying, according to the Center for Responsive Politics.

And it gets results. In the past 15 years, AT&T has successfully acquired a dozen firms and regularly wins its regulatory battles on Capitol Hill and at the FCC.

With that record, the company was confident it could push through the T-Mobile deal. AT&T, which has been hit with complaints from customers about dropped calls, wanted to improve its broadband coverage to compete with rival behemoth Verizon. This deal, AT&T argued, would allow it to do that. Plus, the climate in Washington seemed right. Months before, officials had okayed another blockbuster deal, the $30 billion joint venture between Comcast and NBC. And surely the administration would be on board, AT&T reasoned. In his State of the Union speech, President Barack Obama had deemed expanding broadband access a national priority.

With the company’s biggest bet in years on the line, AT&T’s government operatives, led by Cicconi, a former staffer for George H.W. Bush, relied on the political playbook that has worked for the company countless times. It hired seven former congressional lawmakers to help lobby for the deal. Besides pouring tens of millions into political advertising, the firm had the support of lawmakers whose campaigns it had funded and third-party groups it supports financially, from the NAACP to the Louisiana Ballooning Foundation.

And in its estimated $40 million ad campaign and discussions with government officials, AT&T latched onto an argument it was sure would win over Washington — jobs — saying the merger would put thousands of Americans to work.

So how did one of Washington’s most feared lobbying operations wind up in a losing battle with regulators?

The old playbook backfired, according to dozens of interviews with government officials, lobbyists and consumer groups. On Friday, a federal judge also blasted the company for “using” its court battle to game the system.

The letters from third-party groups raised eyebrows at government agencies and on the Hill, where people began wondering why groups with no obvious ties to broadband were writing in. News reports emerged showing that many of the groups had financial ties to AT&T.

Then there were the ads that staff members at the FCC said they couldn’t avoid when they opened a newspaper, fired up their iPads or watched TV — all touting the merger’s ability to put thousands of Americans to work. But who had ever heard of a big company merger creating rather than destroying jobs?

And the Obama administration was pivoting to a new theme that would echo a feeling, embodied by the Occupy Wall Street movement, that corporate power has run amok in this country. Last week, in a speech in Osawatomie, Kan., Obama invoked the legacy of Teddy Roosevelt, the first president to leverage the country’s antitrust laws to bust monopolies.

Ultimately, the closer antitrust officials looked at the facts of the case, the more it troubled them that two carriers — AT&T and Verizon — could potentially own 80 percent of the country’s wireless market.

In August, the Justice Department sued to block the merger. And last month, there was another blow when the FCC released a damning report concluding that the deal would not only hurt competition but also destroy jobs. The agency’s move to block the merger has made the deal close to impossible, some experts say.

“This has been some of the worst couple weeks of my life,” said Cicconi, whose team now has the job of salvaging the deal in a tougher political atmosphere — in this moment of the Occupiers, when mistrust about Wall Street and big business is running high. What began as an exercise of old-school lobbying muscle might become a lesson in corporate overreach.

When the companies announced their intentions in March, the size of the blockbuster deal raised immediate questions. But policy experts and Wall Street analysts said that if anyone could succeed, it would be AT&T, one of the most politically powerful companies in the country.

“We are confident AT&T would have worked through both the political calculus and the hard numbers,” wrote former Stifel Nicolaus analyst Rebecca Arbogast in a March research note. “AT&T has a sterling record of getting deals approved by the government.”

From 1998 to 2010, the firm handed out more than $45 million to Democratic and Republican candidates, more than any other company in America. During that period, AT&T also shelled out more than $130 million for lobbying.

With the biggest merger in years at stake, AT&T’s lobbying machine kicked into gear.

The company brought on 18 outside firms to assist in the all-out effort, enlisting the help of former U.S. senators John Breaux, D-La., and Trent Lott, R-Miss. Since the merger was unveiled, the company has spent more than $9 million on lobbying, according to public records.

It was a smooth, highly synchronized campaign. In every ad, letter and meeting with lawmakers and regulators, the company hammered home three reasons the merger should be approved: It would create jobs, bring the Internet to isolated and neglected areas of the country, and help Americans get online and compete better with countries that are leaping ahead in high-tech innovations, according to Capitol Hill staff and government officials.

“AT&T looked at this administration that was viewed as weak on regulation early on, and I think they were willing to test if it would live up to that reputation,” said Harold Feld, legal director at the consumer advocacy group Public Knowledge.

At first, few critics emerged, except for competitor Sprint Nextel and consumer advocacy groups. The Communication Workers of America signed on as one of the merger’s most powerful allies. AT&T won the support of 117 lawmakers, who signed a letter urging regulators to approve the deal. All but one had received campaign contributions from AT&T employees, according to the Center for Responsive Politics.

But as the reviews at Justice and the FCC got underway, arguments against the deal were beginning to sway other lawmakers on the Hill and, more important, the regulators.

After a Judiciary Committee hearing in May, in which AT&T chief Stephenson testified, Sen. Herb Kohl, D-Wis., sent a strongly worded letter to regulators urging them to oppose the deal.

“I have concluded that this acquisition, if permitted to proceed, would likely cause substantial harm to competition and consumers, would be contrary to antitrust law and not in the public interest, and therefore should be blocked by your agencies,” he wrote.

Meanwhile, some of AT&T’s aggressive tactics were not having their desired effect.

Hundreds of letters were pouring in to lawmakers’ and regulators’ offices from public-interest groups that seemed unrelated to the deal.

The Virginia Asian Chamber of Commerce, which counts AT&T as a sponsor, told the FCC to approve the deal quickly, arguing that as a group “striving to create bridges between cultures, we look forward to the foundation that this merger will create and the opportunities that it will give the public.” The FCC also received letters from a homeless shelter called the Shreveport-Bossier Rescue Mission, the National Urban League and many other groups that had received financial support from AT&T.

It was all ringing a little false to lawmakers and regulators, who took the mailings as a sign that AT&T could not support the merger on legal grounds alone.

AT&T’s blitzkrieg of ads, which claimed that the promised expansion of broadband would create 100,000 jobs, wasn’t helping, either.

A deal’s impact on jobs is not typically part of an evaluation by antitrust officials, but this time regulators thought AT&T’s campaign had forced them to take a closer look. They found holes. For one, the company refused to divulge how many jobs it would eliminate in the merger.

At the news conference announcing the Justice Department’s suit to block the deal, Deputy Attorney General James Cole said doing so would “protect jobs in the economy.”

Incredulous staff members at the FCC also sent a harshly worded letter in the fall saying the company had “produced almost nothing” to prove its job claims. Their skepticism grew when an AT&T lawyer accidently made public unredacted documents on the agency’s Web site that critics say showed the company was planning to expand its broadband network even if the merger didn’t go through.

And on the key question of whether the deal would harm competition, AT&T was unable to sway both agencies. They concluded that the merger would create a troubling near-duopoly, with AT&T and Verizon controlling nearly 80 percent of all cellphone contracts.

If the proposal weren’t so clearly anti-competitive, according to legal experts, the work of AT&T’s powerful government operators could have helped smooth out any rough edges for regulators willing to work out a compromise.

Staffers at both agencies, who coordinated closely on their reviews, said concessions in the form of divestitures and conditions couldn’t solve the problem that the merger would control too much of the market.

“Antitrust law is not about lobbying,” said Reed Hundt, who served as FCC chairman during the Clinton administration. “Maybe they wanted to push the edge of antitrust law, but I’ve never seen a merger get through just on lobbying.”

The rejections from the government caught the corporate giant off guard.

Three months before the FCC delivered its blow, the company was equally unprepared when Justice blocked the deal. The morning of the announcement, Stephenson told CNBC anchors that he was confident regulators would agree the deal was good for the economy.

In characteristic style, AT&T remains uncowed. It’s getting ready for its showdown in court against the Justice Department. And in response to the FCC’s report on the merger, AT&T sent a scathing letter calling the document “an advocacy piece, and not a considered analysis.”

Asked later whether the company was biting the hand of the regulatory agency that will decide on future deals, Cicconi said: “We had to do it. Their report was harshly worded, too.”

While the battle is not over, AT&T is paying a heavy cost for the government’s disapproval. Last month the company took a $4 billion write-down to cover the breakup fee it must pay to Deutsche Telekom, T-Mobile’s parent, if the deal is not completed by September. Even so, in AT&T’s view, the merger isn’t dead.

“We have lived in fear of them for so long,” said Maura Corbett, president of the Glen Echo Group, which helped organize a coalition opposing the deal. “But there is a point where you jump the shark. There is a point where you overplay your hand.”