Mr. Sievert had been waiting in the wings. A provision in his employment agreement guaranteed that he would be paid as much as $58 million if there was a change in leadership at T-Mobile and the job did not go to him.

Despite a few bumps, the company’s acquisition of Sprint, which is controlled by SoftBank of Japan, had been moving forward over the last two years. In recent months it won approval by the Justice Department and the Federal Communications Commission after T-Mobile and Sprint agreed to sell off significant portions of their businesses to the pay-television operator Dish Network as part of a plan to create a potential new major wireless company.

But a significant hurdle remains: a lawsuit filed by attorneys general from 15 states and the District of Columbia who are trying to block the merger. They argue that the reduction of major wireless carriers from four to three would inevitably drive up prices for cellphone customers and result in a significant loss of jobs. The deal cannot go through until the suit is resolved. The trial is expected to start next month.

Letitia James, New York’s attorney general, has argued that the deal would cost subscribers at least $4.5 billion annually and is “exactly the sort of consumer-harming, job-killing mega-merger our antitrust laws were designed to prevent.” Mr. Legere said that he felt good about the possibility of settling the suit but that if it went to trial, “we’re ready.”

Because of the lawsuit, the original deadline for T-Mobile’s acquisition of Sprint has come and gone. In the meantime, T-Mobile has pushed to renegotiate the terms of the deal.

During this period of uncertainty, Mr. Legere was also considered for the job of chief executive at another company controlled by SoftBank: the commercial real estate start-up WeWork.

SoftBank recently bailed out WeWork, and Sprint’s executive chairman, Marcelo Claure, became WeWork’s executive chairman as part of SoftBank’s rescue effort. The possibility of Mr. Legere’s move raised questions of a possible conflict of interest because of Softbank’s role with both WeWork and Sprint, the T-Mobile merger partner.