Food and Drug Administration Commissioner Scott Gottlieb is leaving his post as the agency wages pitched battles against teen smoking and the opioid crisis, and tackles complex new rules to regulate some cannabis products.

Gottlieb, who's credited with leading the FDA's charge against underaged vaping, is resigning to spend more time with his family, he said in a letter to FDA staff posted on Twitter. He tendered his resignation to Health and Human Services Secretary Alex Azar in a letter Tuesday.

Gottlieb letter to staff

Gottlieb, a 46-year-old cancer survivor, had seemingly managed to avoid some of the political chaos that has engulfed other parts of the Trump administration. President Donald Trump commended Gottlieb's work at the agency, saying he's done an "absolutely terrific job."

"Scott has helped us to lower drug prices, get a record number of generic drugs approved and onto the market, and so many other things. He and his talents will be greatly missed!" Trump said in a Tweet.

The physician has been commuting from his home in Westport, Connecticut, where he has a wife and three young daughters, the people said. He plans to stay on at the agency for another month; his successor hasn't been named yet, they said.

"Scott's leadership inspired historic results from the FDA team, which delivered record approvals of both innovative treatments and affordable generic drugs, while advancing important policies to confront opioid addiction, tobacco and youth e-cigarette use, chronic disease, and more," Azar said in a statement.

Gottlieb's resignation comes just two months after publicly denying reports that he was planning to step down. Stat News had been pursuing the story when Gottlieb on Twitter said he was not leaving the agency. His senior communications advisor, Nina Devlin, left her role at the end of January.

Gottlieb tweet

Gottlieb is widely respected in the health-care industry. He's made speeding up approvals of generic drugs, among other measures to lower drug prices, a priority.

One of Gottlieb's first initiatives was to overhaul the agency's tobacco policies. He introduced a sweeping plan in the summer of 2017 to lower the nicotine in combustible cigarettes to minimally or non-addictive levels while trying to get more adult smokers to switch to e-cigarettes.

"Very few people have been more boldly on the side of consumers, lower drug prices and public health, willing to take on drug manufacturers and tobacco companies and make tough decisions," said Andy Slavitt, former Centers for Medicare and Medicaid Services administrator.

His tobacco policies have not come without criticism. Some have blamed his decision to allow e-cigarettes to stay on the market for years after they were initially supposed to come off for fueling an "epidemic" of teen vaping. For the past year, Gottlieb has tried to push policies to curb teen use while keeping the products available for adult smokers.

He has also spearheaded efforts to ban menthol cigarettes, a move that has been widely applauded. However, none of the tobacco policies Gottlieb has introduced have been implemented yet.

Tobacco stocks rose on the news. Shares of Altria Group advanced less than 1 percent while shares of British American Tobacco traded in the U.S. gained 1.9 percent.

"Commissioner Gottlieb's legacy will depend on whether his many proposals are implemented and, in the case of the youth e-cigarette epidemic, strengthened going forward," Campaign for Tobacco-Free Kids President Matthew Myers said in a statement.

Gottlieb was sworn in as FDA Commissioner in May 2017. He served numerous stints at the agency, including as deputy commissioner for medical and scientific affairs and as a senior advisor to the FDA commissioner.

Before becoming commissioner, Gottlieb was a resident fellow at the American Enterprise Institute and a clinical assistant professor at the New York University School of Medicine, where he also practiced as a physician.

In his resignation letter, Gottlieb did not specify why he was leaving. He cited his work approving a record number of generic drugs, cracking down on tobacco sales to minors, addressing the opioid crisis, managing the government shutdown and other accomplishments during his tenure.

"I'm grateful to have shared these opportunities with my FDA colleagues," he wrote. "I'm thankful to their support and commitment to our shared mission. And I'm thankful to my family for their support in enabling me to take on the privilege of serving in this role."

Adam Fein, CEO of Pembroke Consulting's Drug Channels Institute, said Gottlieb leaves "very big shoes to fill."

Richard Evans, who leads SSR's health practice, said he was a "big fan" of Gottlieb and is disappointed to see him leave.

"I can't think of anyone else like that who gets the way the (pharmaceutical) industry is regulated by the FDA, how the industry works economically, understands the science as a physician, understands the bureaucracy as a former staffer and just wants to do the right thing," he said.

John Maraganore, CEO of biopharma company Alnylam, called Gottlieb a "great" commissioner "who oversaw the continued modernization of FDA and the approval of many innovative medicines."

Sabah Oney, chief business officer of Alector, a company in the neurodegeneration field that just went public, said it was the right time to have an FDA commissioner "who's open and willing to work with innovators."

"We felt like Gottlieb was that person," he said. "We felt like we had a partner there and now there were a lot of unknowns."

— CNBC's Bertha Coombs, Kayla Tausche, Meg Tirrell and Christina Farr contributed to this report.

WATCH: Gottlieb appears on CNBC the day he announces his resignation