Jeff Immelt, who has led General Electric GE

The company on Monday named John Flannery, the president and CEO of GE Healthcare, as the new CEO, effective August 1.

Immelt will remain as chairman through the end of this year.

Immelt, 61, succeeded legendary CEO Jack Welch, who led the company for 20 years and vastly increased its size and scope. Immelt took over on Sept. 7, 2001, four days before the terrorist attacks. He also led the company through the 2008 crisis in financial markets.

Unlike Welch, Immelt oversaw the shedding of many divisions that were part of the company when he joined, including the NBC television network and much of the assets of GE Capital, a financial services business that was once the largest part of the company.

Related: Good GE jobs moving from the US to Canada

GE (GE) stock has struggled in recent years, falling more than 10% this year even as the broader stock market reached record levels. The stock has been the worst performing component of the Dow Jones industrial average since Immelt became CEO. Shares climbed 5% in early trading Monday after the announcement about Immelt.

The shrinking of the company's portfolio of businesses is probably not over. Immelt and GE have been under pressure from an activist investment fund to cut costs and increase profits to boost the stock price.

Just last week, GE announced to employees that it was putting its iconic light bulb business up for sale. The company was co-founded by Thomas Edison, the inventor of the light bulb.

Related: GE wants to unload iconic light bulb business

Immelt has clashed with the Trump administration, criticizing its travel ban, its advocacy for more protectionist trade policies, the rollback of environmental regulations and the country's exit from the Paris deal on climate change, among other issues.

GE said Immelt's departure follows succession planning that began in 2011.

"Jeff has positioned the company incredibly well for the future," said Jack Brennan, lead independent director for GE's board. "He executed a massive portfolio transformation and navigated the company through economic cycles and business disruptions. Today, GE is a high-tech industrial company with a bright future."

Related: GE factory in Paul Ryan's backyard moving to Canada

Flannery, 55, joined the company in 1987, evaluating risk for leveraged buyouts. Early in his GE career he worked on corporate restructurings. He has spent almost half his career living outside of the United States, running GE units in South America and Asia.

He also worked on the shrinking GE Capital, the initial public offering of GE's Synchrony Financial unit and the sale of GE Appliances for $3.3 billion in 2014.

-- CNNMoney's Matt Egan contributed to this story.