Sprint and T-Mobile Loved to Attack Each Other. Then They Decided to Merge.

With attack ads and needling social-media posts that flew back and forth over the course of a decade, T-Mobile and Sprint seemed to agree on one thing: They did not get along.

“You would’ve thought they hated each other,” Jeff Kagan, an independent wireless and telecommunications analyst, said of the third- and fourth-largest wireless carriers in the United States.

The tactic of turning a rival company into an enemy worthy of scorn went all the way to the top.

In a 2017 Harvard Business Review article, John Legere, T-Mobile’s pugnacious chief executive, wrote that his marketing strategy involved creating “the idea of an evil force” and finding “villains to fight.”

“He attacked, just to get noticed — he just never gave up,” Mr. Kagan said. “It was distasteful, it wasn’t comfortable, but it worked.”

Sprint’s leader, Marcelo Claure, was also primed for a feud, calling Mr. Legere a “con artist” in a 2016 tweet.

The aggression was often delivered in cheerful packaging, heavy on T-Mobile’s signature color, a bright magenta. For three years, the company’s face was Carly Foulkes, a sunny spokeswoman who praised T-Mobile while cheerfully denigrating the competition.

In one 2017 commercial, a seasonal cartoon modeled after vintage Claymation specials, Mr. Legere took the lead role, appearing as a foul-mouthed character who told a cautionary holiday tale that painted AT&T and Verizon in a dim light.

T-Mobile may have directed most of its venom at its two larger rivals, but Sprint wasn’t spared.

On its official Twitter account, T-Mobile insulted the smaller company’s social media technique, calling it “#amateurhour.” And when one T-Mobile customer posted a message on Twitter saying that he was considering switching to another brand, @TMobile replied, “To Sprint? Gross. Why would you do that to yourself?”

On his personal Twitter account, which has more than 6 million followers, Mr. Legere once described Sprint as “full of it” and “#alwayslate,” teased Sprint’s Kansas City hometown and took other unprintable jabs at the company.

Sprint had some barbs of its own. In 2011, when AT&T was trying to take over T-Mobile, Sprint ran an ad arguing against the potential merger. To illustrate its point, Sprint dressed a cigar-toting man in a pink polka-dot dress that was similar to something Ms. Foulkes might have worn in a T-Mobile commercial. The tagline: “It makes sense if you don’t think about it.”

[Read more about the merger and the conditions imposed by the Justice Department here.]

The ad was poorly received, and not just by T-Mobile. Michelle Bradley, a transgender woman and community radio advocate, wrote in a blog post that Sprint had “crossed the line.” The company pulled the ad, which had run in newspapers and online.

Sprint went beyond the usual bounds of advertising speech again in a 2016 commercial that took aim at T-Mobile. Mr. Claure appeared in the ad, soliciting opinions from a group of wireless customers gathered in a glass-walled conference room. Turning to a white woman seated to his right, he asked her to tell him “what comes to mind” when she heard the name T-Mobile.

“Oh my god, the first word that came to my head was ‘ghetto,’” she responded, grimacing, as Mr. Claure nodded.

He later linked to the video on Twitter, writing that “sometimes the truth hurts.” Within hours, the video had been taken down, and Mr. Claure had apologized for the company’s “bad judgment.”

As the two companies moved closer to a merger in recent years, the rhetoric mellowed. And on Friday, when the Justice Department announced that it had approved the deal, the combative tone that once characterized the carriers’ marketing efforts seemed all the more strange.

In retrospect, the hostilities between T-Mobile and Sprint were nothing more than marketing theatrics. The two companies came to decide that, if they were going to compete on an equal footing with AT&T and Verizon, they would need to become not only allies, but partners. The trash-talking stopped.

In an ad that aired during the Super Bowl in February, instead of going after its corporate rivals, T-Mobile, which calls itself the “Un-carrier,” poked gentle fun at tech-illiterate fathers and oversharing texters. Sprint’s ad took aim at AT&T and Verizon, leaving out its former sparring partner.

This past spring, T-Mobile appointed Matt Staneff as its first chief marketing officer in nearly two years. Mr. Staneff said in an email that marketing at the company “hasn’t changed at all,” while also saying that T-Mobile’s “tone and message has shifted” as the brand matured.

“We don’t play favorites to anyone,” he said. “It’s no secret that, historically, AT&T and Verizon — or “dumb and dumber” as our CEO calls them — are best at wronging consumers.”

“It’s just harder to do attack ads on a partner, to beat up on the person you’re having drinks with every day,” said Chetan Sharma, a telecommunications strategist who is a consultant to carriers.

Attack ads have helped many companies promote their products, as Apple and Microsoft did for years in warring commercials for Macs and PCs. The telecommunications industry, however, embraced confrontation as its default marketing mode.

But ad fatigue has started to set in among many wireless customers, a numbing effect that Sprint addressed in a recent commercial. Across all industries, attack ads appear to be softening, according to Henry Assael, a marketing professor at New York University.

“Generally,” he said, “the American consumer doesn’t like to see a fight going on — they would prefer to see just a straight story than one company attacking another.”

Once T-Mobile completes its $26 billion acquisition of Sprint, creating a new wireless company that will go under the T-Mobile name, will it return to its old belligerence as it tries to lure customers away from AT&T and Verizon?

Probably, Mr. Staneff said.

“The new T-Mobile will have the scale and resources to be an even more aggressive challenger to AT&T, Verizon, Comcast, Charter and the rest,” he said. “Expect a supercharged Un-carrier with supercharged marketing behind it.”

Sprint and T-Mobile Loved to Attack Each Other. Then They Decided to Merge.