The third-largest U.S. wireless carrier will go to trial on Dec. 9 to fight a state attorneys general lawsuit that alleges the merger would be harmful to consumers.

T-Mobile said Legere will remain CEO until April 30, and will be succeeded by President and Chief Operating Officer Mike Sievert. Legere will continue to be a member of T-Mobile's board.

Legere, the outspoken architect of the marketing and business strategy that helped T-Mobile become known as an innovator in the wireless industry, said the succession plan had long been in the works.

"A CEO with a board that doesn't have a good succession plan, fails," Legere said on a conference call with analysts. "It's Mike's time. He's ready."

T-Mobile remains focused on closing the merger with Sprint, Legere said.

"I feel quite good that we have the basis for settling this deal, and I feel equally good, if not better, about winning this trial," he added.

T-Mobile has also been in talks with Sprint to extend their merger agreement, which had expired Nov. 1. A reduced price for Sprint could potentially be part of the negotiations.

Legere said Monday the company's shareholders were working on a new agreement, but said he could not provide a timeframe.

Legere also said he had never been in discussions to run WeWork, saying the news reports had created an "awkward period of time" for T-Mobile. Japan's Softbank Group Corp is the controlling shareholder for both Sprint and WeWork.

Sievert, also a member of T-Mobile's board, has worked alongside Legere for the last seven years.

"It has been widely expected for some time that John would exit next year, so this won’t come as a shock to anyone," said Craig Moffett, an analyst at MoffettNathanson. "And Mike has always been extremely highly regarded by the investment community. I expect they’ll make the transition without missing a beat."

Shares of T-Mobile were little changed at $78.23 in afternoon trading, while Sprint was up 1.03%.

(Reporting by Supantha Mukherjee, Sheila Dang, Munsif Vengattil and Diane Bartz; Editing by Sriraj Kalluvila, Anil D'Silva and Dan Grebler)

By Sheila Dang and Supantha Mukherjee